Commit faf02c8a authored by Laurent Belcour's avatar Laurent Belcour

Working on rational function

parent bf204fbf
......@@ -57,8 +57,32 @@ vec rational_function::value(const vec& x) const
return res ;
}
bool compare(std::vector<std::vector<int> > a, std::vector<int> b)
{
bool current = false;
for(int i=0; i<a.size(); ++i)
{
int nb_equals = 0;
for(int j=0; j<b.size(); ++j)
{
if(a[i][j] == b[j])
{
++nb_equals ;
}
}
if(nb_equals == b.size())
current = true;
}
return current ;
}
void populate(std::vector<int>& vec, int N, int k, int j)
{
// Already used vectors
std::vector<std::vector<int> > already_used ;
vec[0] = k ;
if(j == 0)
return ;
......@@ -66,6 +90,8 @@ void populate(std::vector<int>& vec, int N, int k, int j)
int tj = j ;
while(tj != 0)
{
already_used.push_back(vec) ;
// First non null index
int nn_index = 0; while(vec[nn_index] == 0) { nn_index = (nn_index+1) % N ; }
......@@ -79,6 +105,7 @@ void populate(std::vector<int>& vec, int N, int k, int j)
}
}
std::vector<int> rational_function::index2degree(int i) const
{
std::vector<int> deg ; deg.assign(dimX(), 0) ;
......@@ -100,7 +127,6 @@ std::vector<int> rational_function::index2degree(int i) const
// Populate the vector from front to back
int j = i-Nk ;
populate(deg, dimX(), k, j) ;
return deg ;
}
......
......@@ -50,7 +50,7 @@ class rational_function : public QObject, public function
void save_rational_function(const std::string& filename) const ;
void save_gnuplot(const std::string& filename, const data* d, const arguments& args) const ;
protected: // functions
// protected: // functions
// Convert an index in N to a vector of degree for a
// multinomial coeffcient. The resulting vector v should
......
......@@ -55,6 +55,7 @@ bool rational_fitter_cgal::fit_data(const data* dat, function* fit)
r->setMin(d->min()) ;
r->setMax(d->max()) ;
std::cout << "<<INFO>> np in [" << _min_np << ", " << _max_np
<< "] & nq in [" << _min_nq << ", " << _max_nq << "]" << std::endl ;
......
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