Commit 36636f2e authored by Laurent Belcour's avatar Laurent Belcour

Correcting some mistakes

parent fed8ed4e
syntax: glob
documents/doxygen
.*.swp
moc_*
Makefile
*.o
*.rational
*.errorplot
*.gnuplot
oprofile_data
*.so.*
*.so
......@@ -15,7 +15,7 @@ class data ;
*
* \details
* function are functors with a domain of definition specified by a vector
* interval \f$[\vec{min} .. \vec{max}]\f$ where \f$\vec{min}\f$ and
* interval \f$[\vec{min} .. \vec{max}]\f$ where \f$\vec{min}\f$ and
* \f$\vec{max}\f$ have the size of the input domain.
*
* Any function used by the fitting algorithm should overload publicly this
......
......@@ -157,8 +157,12 @@ std::vector<int> rational_function::index2degree(int i) const
if(i == 0)
return deg ;
if(dimX() == 2)
if(dimX() == 1)
{
deg[0] = i;
}
else if(dimX() == 2)
{
int Nk = 1 ;
int k = 1 ;
......@@ -209,7 +213,7 @@ double legendre(double x, int i)
}
}
#define POLYNOMIALS
//#define POLYNOMIALS
// Get the p_i and q_j function
double rational_function::p(const vec& x, int i) const
......@@ -341,9 +345,9 @@ void rational_function::load(const std::string& filename)
}
void rational_function::save(const std::string& filename, const arguments& args) const
{
if(args.is_defined("export-format"))
if(args.is_defined("export"))
{
if(args["export-format"].compare("c++") == 0)
if(args["export"].compare("c++") == 0)
{
std::cout << "<<INFO>> will export in C++ format" << std::endl;
save_cpp(filename, args);
......@@ -365,7 +369,7 @@ void rational_function::save(const std::string& filename, const arguments& args)
void rational_function::save_cpp(const std::string& filename, const arguments& args) const
{
std::ofstream file(filename.c_str(), std::ios_base::trunc);
file << "double* brdf(double* x)" << std::endl;
file << "double brdf(double* x)" << std::endl;
file << "{" << std::endl;
file << "\tdouble p = ";
......@@ -388,7 +392,7 @@ void rational_function::save_cpp(const std::string& filename, const arguments& a
}
file << ";" << std::endl;
file << "\treturn p/q;";
file << "\treturn p/q;" << std::endl;
file << "}" << std::endl;
file.close() ;
......
......@@ -57,9 +57,9 @@ class rational_function : public QObject, public function
protected: // functions
// Convert an index in N to a vector of degree for a
// multinomial coeffcient. The resulting vector v should
// be used as prod_k x[k]^v[k]
//! Convert a 1D index into a vector of degree for a
//! multinomial coeffcient. The resulting vector v should
//! be used as prod_k x[k]^v[k] for the monomial basis
std::vector<int> index2degree(int i) const ;
protected: // data
......
......@@ -8,7 +8,7 @@ DESTDIR = ../../build
INCLUDEPATH += ../..
HEADERS = _fitter.h
HEADERS = fitter.h
SOURCES = fitter.cpp
LIBS += -L../../build \
......
......@@ -160,8 +160,8 @@ bool rational_fitter_dca::fit_data(const data* d, int np, int nq, rational_funct
{
if(i<np*nY)
{
ui(i) = 100.0; // std::numeric_limits<double>::max();
li(i) = -100.0; //-std::numeric_limits<double>::max();
ui(i) = 1.0E30; // std::numeric_limits<double>::max();
li(i) = -1.0E30; //-std::numeric_limits<double>::max();
}
else if(i<(np+nq)*nY)
{
......@@ -170,8 +170,8 @@ bool rational_fitter_dca::fit_data(const data* d, int np, int nq, rational_funct
}
else
{
ui(i) = 100.0; // std::numeric_limits<double>::max();
li(i) = -100.0; //-std::numeric_limits<double>::max();
ui(i) = 1.0E30; // std::numeric_limits<double>::max();
li(i) = -1.0E30; //-std::numeric_limits<double>::max();
}
}
memcpy((void *)mxGetPr(u), (void *)ui.data(), N*nY*sizeof(double));
......@@ -314,7 +314,7 @@ bool rational_fitter_dca::fit_data(const data* d, int np, int nq, rational_funct
#endif
// Compute the new delta_k, the distance to the data points
delta = distance(r, d);
// delta = distance(r, d);
}while(delta <= delta_k);
......
......@@ -167,10 +167,14 @@ bool rational_fitter_eigen::fit_data(const vertical_segment* d, int np, int nq,
min_val = value ;
}
}
if(min_val == std::numeric_limits<double>::max())
{
return false;
}
#endif
// Recopy the vector d
std::vector<double> p, q;
p.assign(np, 0.0) ; q.assign(nq, 0.0) ;
vec p(np), q(nq);
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);
......
......@@ -13,7 +13,6 @@
#include <QTime>
data* rational_fitter_quadprog::provide_data() const
{
return new vertical_segment() ;
......
......@@ -13,7 +13,13 @@
#include <core/fitter.h>
#include <core/args.h>
/*! \todo This plugin is not working with 1D example. This is weird. Use the following command
* to generate the bug:
\verbatim
./build/plugin_loader --input ../data/1d/transmi_lame_50_50_avg45.txt --output output.rational --fitter librational_fitter_quadprog.so --min 400 --max 500 --min-np 1 --min-nq 1 --np 20 --nq 20 --dt 0.01
\endverbatim
It should freeze after np = 6 and nq = 6
*/
class rational_fitter_quadprog : public QObject, public fitter
{
Q_OBJECT
......
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