Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit 4544fba8 authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Updating the interface of nonlinear fitters and functions to adopt shared...

Updating the interface of nonlinear fitters and functions to adopt shared pointers for data. Note this is not a clean REV to updated to. ALTA won't comile.
parent f18263e7
......@@ -105,7 +105,7 @@ nonlinear_fitter_ceres::~nonlinear_fitter_ceres()
{
}
bool nonlinear_fitter_ceres::fit_data(const data* d, function* fit, const arguments &args)
bool nonlinear_fitter_ceres::fit_data(const ptr<data> d, function* fit, const arguments &args)
{
// I need to set the dimension of the resulting function to be equal
// to the dimension of my fitting problem
......
......@@ -61,7 +61,7 @@ class nonlinear_fitter_ceres: public fitter
// Fitting a data object
//
virtual bool fit_data(const data* d, function* fit, const arguments& args) ;
virtual bool fit_data(const ptr<data> d, function* fit, const arguments& args) ;
// Provide user parameters to the fitter
//
......
......@@ -20,7 +20,7 @@ ALTA_DLL_EXPORT fitter* provide_fitter()
struct EigenFunctor: Eigen::DenseFunctor<double>
{
EigenFunctor(nonlinear_function* f, const data* d, bool use_cosine) :
EigenFunctor(nonlinear_function* f, const ptr<data> d, bool use_cosine) :
Eigen::DenseFunctor<double>(f->nbParameters(), d->dimY()*d->size()), _f(f), _d(d), _cosine(use_cosine)
{
#ifndef DEBUG
......@@ -130,7 +130,7 @@ struct EigenFunctor: Eigen::DenseFunctor<double>
nonlinear_function* _f;
const data* _d;
const ptr<data> _d;
// Flags
bool _cosine;
......@@ -138,7 +138,7 @@ struct EigenFunctor: Eigen::DenseFunctor<double>
struct CompoundFunctor: Eigen::DenseFunctor<double>
{
CompoundFunctor(compound_function* f, int index, const data* d, bool use_cosine) :
CompoundFunctor(compound_function* f, int index, const ptr<data> d, bool use_cosine) :
Eigen::DenseFunctor<double>((*f)[index]->nbParameters(), d->dimY()*d->size()), _f(f), _index(index), _d(d), _cosine(use_cosine)
{
#ifndef DEBUG
......@@ -261,7 +261,7 @@ struct CompoundFunctor: Eigen::DenseFunctor<double>
compound_function* _f;
const data* _d;
const ptr<data> _d;
// Flags
bool _cosine;
......@@ -275,7 +275,7 @@ nonlinear_fitter_eigen::~nonlinear_fitter_eigen()
{
}
bool nonlinear_fitter_eigen::fit_data(const data* d, function* fit, const arguments &args)
bool nonlinear_fitter_eigen::fit_data(const ptr<data> d, function* fit, const arguments &args)
{
// I need to set the dimension of the resulting function to be equal
// to the dimension of my fitting problem
......
......@@ -45,7 +45,7 @@ class nonlinear_fitter_eigen: public fitter
// Fitting a data object
//
virtual bool fit_data(const data* d, function* fit, const arguments& args) ;
virtual bool fit_data(const ptr<data> d, function* fit, const arguments& args) ;
// Provide user parameters to the fitter
//
......
......@@ -23,7 +23,7 @@ ALTA_DLL_EXPORT fitter* provide_fitter()
class altaNLP : public Ipopt::TNLP
{
public:
altaNLP(nonlinear_function* f, const data* d) : TNLP(), _f(f), _d(d)
altaNLP(nonlinear_function* f, const ptr<data> d) : TNLP(), _f(f), _d(d)
{
}
......@@ -209,7 +209,7 @@ class altaNLP : public Ipopt::TNLP
protected:
const data* _d;
const ptr<data> _d;
nonlinear_function* _f;
};
......@@ -220,7 +220,7 @@ nonlinear_fitter_ipopt::~nonlinear_fitter_ipopt()
{
}
bool nonlinear_fitter_ipopt::fit_data(const data* d, function* fit, const arguments &args)
bool nonlinear_fitter_ipopt::fit_data(const ptr<data> d, function* fit, const arguments &args)
{
// I need to set the dimension of the resulting function to be equal
// to the dimension of my fitting problem
......
......@@ -54,7 +54,7 @@ class nonlinear_fitter_ipopt: public fitter
// Fitting a data object
//
virtual bool fit_data(const data* d, function* fit, const arguments& args) ;
virtual bool fit_data(const ptr<data> d, function* fit, const arguments& args) ;
// Provide user parameters to the fitter
//
......
......@@ -34,7 +34,7 @@ void print_nlopt_error(nlopt_result res, const std::string& string)
// The parameter of the function _f should be set prior to this function
// call. If not it will produce undesirable results.
void df(double* fjac, const nonlinear_function* f, const data* d)
void df(double* fjac, const nonlinear_function* f, const ptr<data> d)
{
// Clean memory
memset(fjac, 0.0, f->nbParameters()*sizeof(double));
......@@ -77,7 +77,7 @@ void df(double* fjac, const nonlinear_function* f, const data* d)
double f(unsigned n, const double* x, double* dy, void* dat)
{
nonlinear_function* _f = (nonlinear_function*)(((void**)dat)[0]);
const data* _d = (const data*)(((void**)dat)[1]);
const ptr<data> _d = *(const ptr<data>*)(((void**)dat)[1]);
// Update the parameters vector
vec _p(_f->nbParameters());
......@@ -125,7 +125,7 @@ nonlinear_fitter_nlopt::~nonlinear_fitter_nlopt()
{
}
bool nonlinear_fitter_nlopt::fit_data(const data* d, function* fit, const arguments &args)
bool nonlinear_fitter_nlopt::fit_data(const ptr<data> d, function* fit, const arguments &args)
{
// I need to set the dimension of the resulting function to be equal
// to the dimension of my fitting problem
......@@ -234,7 +234,7 @@ bool nonlinear_fitter_nlopt::fit_data(const data* d, function* fit, const argume
// Create the problem
void* dat[2];
dat[0] = (void*)nf;
dat[1] = (void*)d;
dat[1] = (void*)&d;
res = nlopt_set_min_objective(opt, f, dat);
if(res < 0)
{
......
......@@ -46,7 +46,7 @@ class nonlinear_fitter_nlopt: public fitter
// Fitting a data object
//
virtual bool fit_data(const data* d, function* fit, const arguments& args) ;
virtual bool fit_data(const ptr<data> d, function* fit, const arguments& args) ;
// Provide user parameters to the fitter
//
......
......@@ -186,7 +186,7 @@ vec schlick::parametersJacobian(const vec& x) const
}
void schlick::bootstrap(const data* d, const arguments& args)
void schlick::bootstrap(const ptr<data> d, const arguments& args)
{
for(int i=0; i<dimY(); ++i) { R[i] = 0.5; }
}
......@@ -49,7 +49,7 @@ class schlick : public nonlinear_function
virtual vec parametersJacobian(const vec& x) const ;
//! \brief Boostrap the function by defining the diffuse term
virtual void bootstrap(const data* d, const arguments& args);
virtual void bootstrap(const ptr<data> d, const arguments& args);
//! \brief resize the parameter vector
virtual void setDimY(int nY)
......
......@@ -98,7 +98,7 @@ vec retro_schlick::getParametersMax() const
return M;
}
void retro_schlick::bootstrap(const data* d, const arguments& args)
void retro_schlick::bootstrap(const ptr<data> d, const arguments& args)
{
for(int i=0; i<dimY(); ++i) {R[i] = 0.5; }
}
......
......@@ -49,7 +49,7 @@ class retro_schlick : public nonlinear_function
virtual vec parametersJacobian(const vec& x) const ;
//! \brief Boostrap the function by defining the diffuse term
virtual void bootstrap(const data* d, const arguments& args);
virtual void bootstrap(const ptr<data> d, const arguments& args);
//! \brief resize the parameter vector
virtual void setDimY(int nY)
......
......@@ -179,7 +179,7 @@ vec schlick_fresnel::parametersJacobian(const vec& x) const
}
void schlick_fresnel::bootstrap(const data* d, const arguments& args)
void schlick_fresnel::bootstrap(const ptr<data> d, const arguments& args)
{
for(int i=0; i<dimY(); ++i) { R[i] = 0.5; }
}
......@@ -58,7 +58,7 @@ class schlick_fresnel : public nonlinear_function
virtual vec parametersJacobian(const vec& x) const ;
//! \brief Boostrap the function by defining the diffuse term
virtual void bootstrap(const data* d, const arguments& args);
virtual void bootstrap(const ptr<data> d, const arguments& args);
//! \brief resize the parameter vector
virtual void setDimY(int nY)
......
......@@ -142,7 +142,7 @@ vec abc_function::parametersJacobian(const vec& x) const
return jac;
}
void abc_function::bootstrap(const data* d, const arguments& args)
void abc_function::bootstrap(const ptr<data> d, const arguments& args)
{
for(int i=0; i<dimY(); ++i)
{
......
......@@ -45,7 +45,7 @@ class abc_function : public nonlinear_function
//! \brief Boostrap the function by defining the diffuse term
//!
//! \details
virtual void bootstrap(const data* d, const arguments& args);
virtual void bootstrap(const ptr<data> d, const arguments& args);
//! \brief Number of parameters to this non-linear function
virtual int nbParameters() const ;
......
......@@ -161,7 +161,7 @@ vec beckmann_function::parametersJacobian(const vec& x) const
return jac;
}
void beckmann_function::bootstrap(const data* d, const arguments& args)
void beckmann_function::bootstrap(const ptr<data> d, const arguments& args)
{
for(int i=0; i<dimY(); ++i)
{
......
......@@ -48,7 +48,7 @@ class beckmann_function : public nonlinear_function
//! \brief Boostrap the function by defining the diffuse term
//!
//! \details
virtual void bootstrap(const data* d, const arguments& args);
virtual void bootstrap(const ptr<data> d, const arguments& args);
//! \brief Number of parameters to this non-linear function
virtual int nbParameters() const ;
......
......@@ -154,7 +154,7 @@ vec blinn_function::parametersJacobian(const vec& x) const
}
void blinn_function::bootstrap(const data* d, const arguments& args)
void blinn_function::bootstrap(const ptr<data> d, const arguments& args)
{
for(int i=0; i<dimY(); ++i)
{
......
......@@ -31,7 +31,7 @@ class blinn_function : public nonlinear_function
//! \brief Boostrap the function by defining the diffuse term
virtual void bootstrap(const data* d, const arguments& args);
virtual void bootstrap(const ptr<data> d, const arguments& args);
//! \brief Load function specific files
virtual bool load(std::istream& filename) ;
......
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