#include <func/func.hpp>
#include "../sample_functions/gamma.hpp"

#include <iostream>
#include <armadillo>
#include <vector>
#include <memory>
#include <iostream>
#include <limits>

#include <boost/multiprecision/cpp_bin_float.hpp>
#define ERR_PREC boost::multiprecision::cpp_bin_float_quad

#define TYPE double
#define MIN_EXP 3
#define MAX_EXP 7
#define NUM_STEPS 80

/*
  Uses the LookupTableGenerator class to compute errors for varying table step sizes
  Or, will plot a collection of LUTs against a direct evaluation
*/
int main(int argc, char* argv[]) {
  using namespace func;
  LookupTableGenerator<TYPE,TYPE,ERR_PREC> gen({FUNC_SET_F(MyFunction,TYPE)},MIN_ARG,MAX_ARG);
  std::string name = "NonUniformExactInterpTable<1>";
  auto B = 1418.73;
  auto h = (gen.generate_by_impl_size(name, (unsigned int) B))->step_size();
  std::cerr << gen.error_at_step_size(name, h, 1.0) << std::endl;
  gen.plot_implementation_at_step_size(name, h, 3000);
}
