Mise à jour terminée. Pour connaître les apports de la version 13.8.4 par rapport à notre ancienne version vous pouvez lire les "Release Notes" suivantes :
https://about.gitlab.com/releases/2021/02/11/security-release-gitlab-13-8-4-released/
https://about.gitlab.com/releases/2021/02/05/gitlab-13-8-3-released/

Commit de43bbdc authored by Laurent Belcour's avatar Laurent Belcour

Adding a L2 and LINF export function. This will be usefull for the LM fitting.

parent 9f1fe6a9
......@@ -19,6 +19,7 @@ HEADERS = args.h \
SOURCES = plugins_manager.cpp \
vertical_segment.cpp \
rational_function.cpp \
params.cpp \
rational_function.cpp \
params.cpp \
function.cpp \
# clustering.cpp
#include "function.h"
#include "common.h"
//! \brief L2 norm to data.
double function::L2_distance(const data* d) const
{
double l2 = 0.0;
int nb_points = d->size();
for(int i=0; i<nb_points; ++i)
{
// Get data point
vec x = d->get(i);
vec y1(d->dimY());
for(int j=0; j<d->dimY(); ++j)
y1 = x[d->dimX() + j];
// Evaluate data
vec y2 = this->value(x);
double dist = norm(y1-y2);
l2 += dist*dist;
}
return sqrt(l2)/(double)nb_points;
}
//! \brief Linf norm to data.
double function::Linf_distance(const data* d) const
{
double linf = 0.0;
int nb_points = d->size();
for(int i=0; i<nb_points; ++i)
{
// Get data point
vec x = d->get(i);
vec y1(d->dimY());
for(int j=0; j<d->dimY(); ++j)
y1 = x[d->dimX() + j];
// Evaluate data
vec y2 = this->value(x);
double dist = norm(y1-y2);
linf = std::max(dist, linf);
}
return linf;
}
\ No newline at end of file
......@@ -200,6 +200,13 @@ class function
NOT_IMPLEMENTED();
}
public: // methods
//! \brief L2 norm to data.
double L2_distance(const data* d) const ;
//! \brief Linf norm to data.
double Linf_distance(const data* d) const ;
protected: // data
......
......@@ -371,7 +371,7 @@ int data_merl::dimY() const
return 3 ;
}
data* provide_data()
ALTA_DLL_EXPORT data* provide_data()
{
return new data_merl();
}
......
......@@ -92,9 +92,13 @@ int main(int argc, char** argv)
std::cout << x << "\t" << f->value(vx)[0] << std::endl ;
}
/*/
double L2 = f->L2_distance(d);
double Linf = f->Linf_distance(d);
std::cout << "<<INFO>> L2 distance to data = " << L2 << std::endl;
std::cout << "<<INFO>> Linf distance to data = " << Linf << std::endl;
f->save(args["output"], args) ;
#ifndef OLD // use brdf2gnuplot
#ifdef OLD // use brdf2gnuplot
size_t n = args["output"].find('.') ;
std::string gnuplot_filename = args["output"].substr(0,n);
gnuplot_filename.append(".gnuplot") ;
......
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