Commit abddc9f7 authored by Laurent Belcour's avatar Laurent Belcour

Cleanning the code and adding test of DCA outputs

parent 61e69c12
......@@ -19,9 +19,6 @@
class data : public parametrized
{
public: // methods
/*
data() : _in_param(params::UNKNOWN_INPUT), _out_param(params::UNKNOWN_OUTPUT) { }
*/
// Load data from a file
virtual void load(const std::string& filename) = 0 ;
......@@ -72,35 +69,11 @@ class data : public parametrized
// Get the size of the input X domain and output Y domain
virtual int dimX() const { return _nX ; }
virtual int dimY() const { return _nY ; }
/*
//! \brief provide the parametrization of the function.
//! \note some function type can modify the parametrization to adapt
//! to the data.
virtual params::input parametrization() const
{
return _in_param;
}
//! \brief can set the input parametrization of a non-parametrized
//! function. Throw an exception if it tries to erase a previously
//! defined one.
virtual void setParametrization(params::input new_param)
{
if(_in_param != params::UNKNOWN_INPUT)
throw("A parametrization is already defined");
_in_param = new_param;
}
*/
protected: // data
// Dimensions of the data
int _nX, _nY ;
/*
// Input and output parametrization
params::input _in_param ;
params::output _out_param ;
*/
} ;
Q_DECLARE_INTERFACE(data, "Fitter.Data")
......
......@@ -26,10 +26,6 @@ class function : public parametrized
{
public: // methods
// Constructor
/* function() : _in_param(params::UNKNOWN_INPUT),
_out_param(params::UNKNOWN_OUTPUT) { }
*/
// Overload the function operator
virtual vec operator()(const vec& x) const = 0 ;
virtual vec value(const vec& x) const = 0 ;
......@@ -106,58 +102,6 @@ class function : public parametrized
}
virtual vec getMin() const { return _min ; }
virtual vec getMax() const { return _max ; }
/*
//! \brief provide the parametrization of the function.
//! \note some function type can modify the parametrization to adapt
//! to the data.
virtual params::input parametrization() const
{
return _in_param;
}
//! \brief provide the output parametrization of the function.
//! \note some function type can modify the parametrization to adapt
//! to the data.
virtual params::output out_parametrization() const
{
return _out_param;
}
//! \brief can set the input parametrization of a non-parametrized
//! function. Throw an exception if it tries to erase a previously
//! defined one.
virtual void setParametrization(params::input new_param)
{
//! \todo Here is something strange happening. The equality between
//! those enums is not correct for UNKNOWN_INPUT
if(_in_param == new_param)
{
return;
}
else if(_in_param == params::UNKNOWN_INPUT)
{
_in_param = new_param;
}
else
{
std::cout << "<<ERROR>> a parametrization is already defined: " << params::get_name(_in_param) << std::endl;
std::cout << "<<ERROR>> trying to change to: " << params::get_name(new_param) << std::endl;
}
}
//! \brief can set the output parametrization of a non-parametrized
//! function. Throw an exception if it tries to erase a previously
//! defined one.
virtual void setParametrization(params::output new_param)
{
if(_out_param == new_param || _out_param == params::UNKNOWN_OUTPUT)
_out_param = new_param;
else
{
std::cout << "<<ERROR>> A parametrization is already defined" << std::endl;
}
}
*/
protected: // function
......@@ -227,10 +171,6 @@ class function : public parametrized
// Dimension of the function & domain of definition.
int _nX, _nY ;
vec _min, _max ;
/*
// Input and output parametrization
params::input _in_param ;
params::output _out_param ;*/
};
/*! \brief Non-linear function interface
......
......@@ -12,8 +12,8 @@ if [ $use_relative -eq 1 ]; then
fi
test_generated=1
test_kirby=0
test_alta=0
test_kirby=1
test_alta=1
test_merl=0
#fitter="matlab"
......@@ -23,7 +23,10 @@ test_merl=0
fitter="eigen"
#fitter_args="--min-np 1 --np 100 --min-nq 1 --nq 100"
fitter_args="--np 3 --nq 3"
fitter_args="--np 10 --nq 10"
#Use the DCA optimizer afterwards
use_dca=1
mkdir tests
......@@ -41,12 +44,20 @@ do
echo "Test number ${i} passed"
./build/brdf2gnuplot --input tests/output${function_append}_${i}.rational $function --data tests/input_${i}.gnuplot --output tests/output_${i}.gnuplot > /dev/null
#DCA Optimization
./build/data2brdf --input tests/input_${i}.gnuplot --output tests/output${function_append}_${i}_dca.rational $function --fitter /build/librational_fitter_dca.so --bootstrap tests/output${function_append}_${i}.rational > tests/output${function_append}_${i}_dca.out
if [ $use_dca -eq 1 ]; then
./build/data2brdf --input tests/input_${i}.gnuplot --output tests/output${function_append}_${i}_dca.rational $function --fitter /build/librational_fitter_dca.so --bootstrap tests/output${function_append}_${i}.rational > tests/output${function_append}_${i}_dca.out
if [ $? -eq 0 ]; then
./build/brdf2gnuplot --input tests/output${function_append}_${i}_dca.rational $function --data tests/input_${i}.gnuplot --output tests/output_${i}_dca.gnuplot > /dev/null
if [ $? -eq 0 ]; then
echo "Optimized using DCA"
./build/brdf2gnuplot --input tests/output${function_append}_${i}_dca.rational $function --data tests/input_${i}.gnuplot --output tests/output_${i}_dca.gnuplot > /dev/null
fi
fi
else
echo "Test number $i failed"
fi
......
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