![]() |
-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 -adic numbers are
implemented in series_carry_naive.hpp.
The relaxed product is available from series_carry_relaxed.hpp.
Mmx]
p == modulus 7
:
Mmx]
a == p_adic (1 mod p, 1 mod p)
:
Mmx]
b == separable_root (a, 2)
:
Mmx]
b^2
:
Mmx]
p_expansion (100, p)
:
Mmx]
p_adic (@p_expansion (100, p))
: