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 d028fa16 authored by Laurent Belcour's avatar Laurent Belcour

dirty solution to export the data and function types

parent 946bf83d
......@@ -23,6 +23,11 @@ class fitter
virtual void set_parameters(const arguments& args) = 0 ;
// Provide a function class and a data class
//
virtual data* provide_data() const = 0 ;
virtual function* provide_function() const = 0 ;
} ;
Q_DECLARE_INTERFACE(fitter, "Fitter.Fitter")
......@@ -31,4 +31,4 @@ class function
int _nX, _nY ;
} ;
Q_DECLARE_INTERFACE(function, "Fitter.Function")
//Q_DECLARE_INTERFACE(function, "Fitter.Function")
......@@ -201,4 +201,4 @@ vec rational_data::max() const
return _max ;
}
Q_EXPORT_PLUGIN2(rational_data, rational_data)
//Q_EXPORT_PLUGIN2(rational_data, rational_data)
TEMPLATE = lib
CONFIG *= qt \
plugin
CONFIG *= static \
qt \
DESTDIR = ../../build
......
......@@ -34,6 +34,15 @@ class rational_fitter_cgal : public QObject, public fitter
virtual void set_parameters(const arguments& args) ;
virtual data* provide_data() const
{
return new rational_data() ;
} ;
virtual function* provide_function() const
{
return new rational_function() ;
} ;
protected: // data
// min and Max usable np and nq values for the fitting
......
TEMPLATE = lib
CONFIG *= qt \
CONFIG *= shared \
qt \
plugin \
eigen \
cgal
......
#include "rational_fitter.h"
#include <Eigen/Dense>
#include <Eigen/SVD>
#include <string>
#include <iostream>
......@@ -119,26 +120,30 @@ bool rational_fitter_eigen::fit_data(const rational_data* d, int np, int nq, int
}
}
// std::cout << CI << std::endl << std::endl ;
// Perform the Eigen decomposition of CI CI'
Eigen::MatrixXd M(np+nq, np+nq);
Eigen::MatrixXd M(np+nq, np+nq) ;
M.noalias() = CI * CI.transpose();
// Faster alternative for large np+nq (only the lower triangular half gets computed):
// M.setZero();
// M.selfadjointView<Lower>().rankUpdate(CI.transpose());
Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd> solver(M) ;
// std::cout << M << std::endl << std::endl ;
if(solver.info() == Eigen::Success)
{
// Calculate the minimum eigen value and
// its position
int min_id = 0;
int min_id = 0;
double min_val = solver.eigenvalues().minCoeff(&min_id);
// Get p and q coefficients from respective eigenvector
// Recopy the vector d
std::vector<double> p, q;
p.assign(np, 0.0) ; q.assign(nq, 0.0);
Eigen::VectorXd::Map(&p[0], np) = solver.eigenvectors().col(min_id).head(np);
Eigen::VectorXd::Map(&q[0], nq) = solver.eigenvectors().col(min_id).tail(nq);
p.assign(np, 0.0) ; q.assign(nq, 0.0) ;
Eigen::VectorXd::Map(&p[0], np) = solver.eigenvectors().col(min_id).head(np);
Eigen::VectorXd::Map(&q[0], nq) = solver.eigenvectors().col(min_id).tail(nq);
r->update(p, q) ;
std::cout << "<<INFO>> got solution " << *r << std::endl ;
......
......@@ -34,6 +34,14 @@ class rational_fitter_eigen : public QObject, public fitter
virtual void set_parameters(const arguments& args) ;
virtual data* provide_data() const
{
return new rational_data() ;
} ;
virtual function* provide_function() const
{
return new rational_function() ;
} ;
protected: // data
// min and Max usable np and nq values for the fitting
......
......@@ -11,6 +11,10 @@
#include <core/fitter.h>
#include <core/args.h>
#include <rational_function.h>
#include <rational_data.h>
class rational_fitter_quadprog : public QObject, public fitter
{
Q_OBJECT
......@@ -30,6 +34,14 @@ class rational_fitter_quadprog : public QObject, public fitter
virtual void set_parameters(const arguments& args) ;
virtual data* provide_data() const
{
return new rational_data() ;
} ;
virtual function* provide_function() const
{
return new rational_function() ;
} ;
protected: // data
// min and Max usable np and nq values for the fitting
......
......@@ -8,6 +8,13 @@
#include <algorithm>
#include <cmath>
extern "C"
{
void* provide_function()
{
return new rational_function() ;
}
}
rational_function::rational_function() : a(), b()
{
......@@ -259,4 +266,4 @@ std::ostream& operator<< (std::ostream& out, const rational_function& r)
}
Q_EXPORT_PLUGIN2(rational_function, rational_function)
//Q_EXPORT_PLUGIN2(rational_function, rational_function)
TEMPLATE = lib
CONFIG *= qt \
plugin
CONFIG *= static \
qt
DESTDIR = ../../build
......
......@@ -48,6 +48,7 @@ int main(int argc, char** argv)
#ifdef DEBUG
std::cout << "<<DEBUG>> loading plugin " << fileName.toStdString() << std::endl ;
#endif
/*
if(dynamic_cast<function*>(plugin) != NULL)
{
#ifdef DEBUG
......@@ -63,7 +64,7 @@ int main(int argc, char** argv)
#endif
datas.push_back(dynamic_cast<data*>(plugin)) ;
}
*/
if(dynamic_cast<fitter*>(plugin) != NULL)
{
#ifdef DEBUG
......@@ -75,7 +76,11 @@ int main(int argc, char** argv)
}
std::cout << "<<INFO>> using " << loader.fileName().toStdString() << std::endl ;
fitters.push_back(dynamic_cast<fitter*>(plugin)) ;
fitter *f = dynamic_cast<fitter*>(plugin) ;
fitters.push_back(f) ;
datas.push_back(f->provide_data()) ;
functions.push_back(f->provide_function()) ;
}
}
......
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