Commit 6172e8ad authored by Laurent Belcour's avatar Laurent Belcour

Debbuging the Fresnel function template. I need to refactor it to

a product function and separate function into the same thing.
parent ff238808
......@@ -255,6 +255,10 @@ class compound_function: public nonlinear_function
{
setParametrization(f->input_parametrization());
}
else if(input_parametrization() != f->input_parametrization())
{
setParametrization(params::CARTESIAN);
}
// Update the output param
if(output_parametrization() == params::UNKNOWN_OUTPUT)
......@@ -591,7 +595,11 @@ class fresnel : public nonlinear_function
virtual vec value(const vec& x) const
{
vec fres = fresnelValue(x);
vec func = f->value(x);
// Convert input space to the function
vec xf(f->dimX());
params::convert(&x[0], params::CARTESIAN, f->input_parametrization(), &xf[0]);
vec func = f->value(xf);
return product(fres, func);
}
......@@ -748,10 +756,14 @@ class fresnel : public nonlinear_function
int nb_fres_params = nbFresnelParameters();
int nb_params = nb_func_params + nb_fres_params;
vec func_jacobian = f->parametersJacobian(x);
// Convert the input value x to the input space of the function
vec xf(f->dimX());
params::convert(&x[0], params::CARTESIAN, f->input_parametrization(), &xf[0]);
vec func_jacobian = f->parametersJacobian(xf);
vec fres_jacobian = getFresnelParametersJacobian(x);
vec func_value = f->value(x);
vec func_value = f->value(xf);
vec fres_value = fresnelValue(x);
// F = fresnel; f = function
......@@ -782,7 +794,7 @@ class fresnel : public nonlinear_function
//! \brief provide the input parametrization of the object.
virtual params::input input_parametrization() const
{
return f->input_parametrization();
return params::CARTESIAN;
}
//! \brief provide the outout parametrization of the object.
......
......@@ -439,6 +439,7 @@ void plugins_manager::check_compatibility(data*& d, function*& f,
else if(d->input_parametrization() != f->input_parametrization())
{
std::cout << "<<INFO>> has to change the parametrization of the input data" << std::endl;
std::cout << "<<INFO>> to " << params::get_name(f->input_parametrization()) << std::endl;
data_params* dd = new data_params(d, f->input_parametrization());
d = dd ;
}
......
......@@ -83,9 +83,9 @@ class CeresFunctor : public ceres::CostFunction
// Fill the columns of the matrix
for(int j=0; j<_f->nbParameters(); ++j)
{
fjac[0][i*_f->nbParameters() + j] = -_jac[i*_f->nbParameters() + j];
}
}
fjac[0][i*_f->nbParameters() + j] = -_jac[i*_f->nbParameters() + j];
}
}
}
protected:
......
......@@ -18,6 +18,13 @@ class diffuse_function : public nonlinear_function
public: // methods
// Set the input parametrization to CARTESIAN to reduce the number
// of transformations in a compound object.
diffuse_function()
{
setParametrization(params::CARTESIAN);
}
// Overload the function operator
virtual vec operator()(const vec& x) const ;
virtual vec value(const vec& x) const ;
......
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