diff --git a/include/mitsuba/core/chisquare.h b/include/mitsuba/core/chisquare.h index a1147f91..cd73413e 100644 --- a/include/mitsuba/core/chisquare.h +++ b/include/mitsuba/core/chisquare.h @@ -267,7 +267,7 @@ protected: const boost::function &pdfFn, size_t nPts, const Float *in, Float *out) { #pragma omp parallel for - for (size_t i=0; i. +*/ + +#include +#include +#include +#include +#include +#include +#include "/Users/wenzel/mitsuba/lookup.h" + +MTS_NAMESPACE_BEGIN + +class UFlakeFit : public Utility { +public: + struct Reference { + Reference(size_t res, size_t nSines) : m_res(res), m_sines(nSines) { + m_directions = new Vector[m_res]; + m_result = new Float[m_res]; + m_error = new Float[m_res]; + for (size_t i=0; i timer = new Timer(); + Float base = refAvgAbsErr; + do { + min[0] = M_PI/2 * (1.0 - std::pow((Float) 2, - (Float) attempt)), + max[0] = M_PI/2 * (1.0 + std::pow((Float) 2, - (Float) attempt)); + NDIntegrator quad(m_res, 2, 200000, 0, 1e-8f); + quad.integrateVectorized(boost::bind( + &Reference::f, this, _1, _2, _3), min, max, m_result, m_error, evals); + Float maxError = 0; + for (size_t i=0; igetMilliseconds()); + ++attempt; + } while (evals < 20000); + + Eigen::MatrixXd A(m_res, m_sines); + Eigen::VectorXd b(m_res); + for (size_t i=0; i