| p-adic integers |
p-adic numbers are implemented as a variant of the series over modular integers: the representation is the same, only the operations differ. All the necessary definitions are gathered in p_adic.hpp.
#include <numerix/p_adic.hpp>
#define C modular<modulus<int, modulus_int_preinverse<14> > >
#define V series_carry_variant_helper<C>::SV
#define P_adic series<C,V>
C::set_modulus (9973);
P_adic p (C (1), 1); // parameter p
P_adic f = 1 / (1 - p);
mmout << f[10] << "\n";
Naive algorithms for p-adic numbers are implemented in series_carry_naive.hpp. The relaxed product is available from series_carry_relaxed.hpp.