coefficients.hpp 561 B

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