Commit e63bac91 by Laurent Belcour

### Updating the degree mapping, it solves everything

parent 373e020f
 ... ... @@ -79,9 +79,33 @@ bool compare(std::vector > a, std::vector b) return current ; } void populate(std::vector& vec, int N, int k, int j) // Estimate the number of configuration for an indice // vector of dimension d with maximum element value // being k. int estimate_dk(int k, int d) { vec[0] = k ; if(d == 1) { return 1; } else { int res = 0; for(int i=0; i<=k; ++i) { res += estimate_dk(k-i, d-1); } return res; } } // Populate a vector of degrees of dimension N using a // maximum degree of M. The index at the current level // is j void populate(std::vector& vec, int N, int M, int j) { #ifdef OLD vec[0] = M ; if(j == 0) return ; ... ... @@ -92,19 +116,43 @@ void populate(std::vector& vec, int N, int k, int j) int nn_index = 0; while(vec[nn_index] == 0) { nn_index = (nn_index+1) % N ; } // Index of the place where to append int ap_index = (nn_index + 1) % N ; while(vec[ap_index] == k) { ap_index = (ap_index+1) % N ; } int ap_index = (nn_index + 1) % N ; while(vec[ap_index] == M) { ap_index = (ap_index+1) % N ; } vec[nn_index] -= 1; vec[ap_index] += 1; --tj; } #else // For each dimension, estimate the current level // based on the number of configurations in the // other dimensions int current_M = M ; int nb_conf = 0; for(int d=0; d rational_function::index2degree(int i) const { std::vector deg ; deg.assign(dimX(), 0) ; if(i == 0) return deg ; ... ... @@ -124,22 +172,21 @@ std::vector rational_function::index2degree(int i) const } else { // Calculate the power (number of elements to put in // the vector) at which the index is definite. int Nk = 1 ; int nk = dimX() ; int k = 1 ; while(!(i >= Nk && i < Nk+nk)) int dk = estimate_dk(k, dimX()) ; while(!(i >= Nk && i < Nk+dk)) { Nk += nk ; nk *= dimX() ; Nk += dk ; ++k ; dk = estimate_dk(k, dimX()) ; } // Populate the vector from front to back int j = i-Nk ; populate(deg, dimX(), k, j) ; } return deg ; } ... ...
 ... ... @@ -52,6 +52,17 @@ bool rational_fitter_quadprog::fit_data(const data* dat, function* fit) << "] & nq in [" << _min_nq << ", " << _max_nq << "]" << std::endl ; /* for(int i=0; i<20; ++i) { std::vector deg = r->index2degree(i) ; std::cout << deg[0] << ", " << deg[1] << ", " << deg[2] << std::endl ; } throw ; //*/ int temp_np = _min_np, temp_nq = _min_nq ; while(temp_np <= _max_np || temp_nq <= _max_nq) { ... ...
 TEMPLATE = subdirs SUBDIRS = generate_data \ plugin_loader \ brdf2gnuplot \ data2gnuplot SUBDIRS = generate_data \ plugin_loader \ brdf2gnuplot \ data2gnuplot \ fourieranalysis
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!