coefficients.hpp 541 B

12345678910111213141516171819202122232425262728
  1. #ifndef COEFFICIENTS_HPP
  2. #define COEFFICIENTS_HPP
  3. #include <mpfr.h>
  4. class Coefficients{
  5. private:
  6. static constexpr size_t prec=4096;
  7. static constexpr size_t imax=1000;
  8. static constexpr size_t ncoeffs=((imax+2)*(imax+1))/2;
  9. double coeffs[ncoeffs];
  10. size_t pos(size_t i,size_t j);
  11. public:
  12. Coefficients();
  13. double get(size_t i,size_t j);
  14. };
  15. inline size_t
  16. Coefficients::pos(size_t i,size_t j){
  17. return i+j*(j+1)/2;
  18. }
  19. inline double
  20. Coefficients::get(size_t i,size_t j){
  21. return (i<j)?coeffs[pos(i,j)]:coeffs[pos(j,i)];
  22. }
  23. #endif