pyadic.padic
- class pyadic.padic.PAdic(num, p=None, k=None, n=0, from_addition=False)
PAdic numbers, with p prime, k digits, n valuation.
- property as_tuple
Tuple reprensentation of the mantissa.
- property as_tuple_from_zero
Tuple representation of the mantissa, shifted to start from p^0 term.
- property k
- property num
0 ≤ num ≤ p ^ k - 1
- property p
p: prime for the padic.
- pyadic.padic.cached_function(func)
- pyadic.padic.check_orderable(func)
- pyadic.padic.full_range_random_padic_filling(p, k)
Returns a random number which translates in a PAdic without any zero digit.
- pyadic.padic.padic_log(w, base=None)
If the valuation is 0, then bring in radius of convergence using Fermat’s little theorem (w ** (p - 1) = 1 mod p), i.e. log_p(w) = log_p(w^(p - 1)) / (p - 1), with w^(p - 1) = 1 + x, x ~ O(p). Otherwise, factor out p ^ valuation, use that log(a * b) = log(a) + log(b) and that log_p(p ^ valuation) = valuation What about branch? See sage docs.
- pyadic.padic.padic_sqrt(x)
Working precision padic sqrt.
- pyadic.padic.padicfy(func)
- pyadic.padic.refine_sqrt_precision(x, s)
Given (s | s^2 - x << 1), makes s^2 closer to x.
- pyadic.padic.to_base(num, p)
pyadic.finite_field
- pyadic.finite_field.LGRR(a, n)
Lattice Gaussian Rational Reconstruction
- pyadic.finite_field.LGreduction(u, v)
Lattice Gaussian Reduction - 2D version of LLL (Lenstra–Lenstra–Lovász)
- pyadic.finite_field.MQRR(u, m, T=None)
Maximal Quotient Rational Reconstruction (M. B. Monagan)
- class pyadic.finite_field.ModP(n, p=None)
Finite field with p elements ($mathbb{FF}_p$), i.e. integers modulo p, with p prime.
- n
- p
- pyadic.finite_field.ModPfy(func)
- pyadic.finite_field.chained_chinese_remainder(*vals, primes=None)
Vectorized (concatenated) version of chinese remainder function.
- pyadic.finite_field.chinese_remainder(a1, a2)
Given a1 = a % n1 and a2 = a % n2 and assuming gcd(n1,n2)=1 (i.e. n1, n2 co-prime), returns a12 = a % (n1*n2)
- pyadic.finite_field.extended_euclidean_algorithm(a, b)
Returns Bezout coefficients (s,t) and gcd(a,b) such that: as+bt=gcd(a,b). - Pseudocode from https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
- pyadic.finite_field.finite_field_sqrt(x)
Returns either False or the first digit of the root in the field.
- pyadic.finite_field.gcd(a, b)
- pyadic.finite_field.isinteger(x)
- pyadic.finite_field.rationalise(a, n=None, algorithm=<function MQRR>)
Given (a, n) returns a fraction r / s such that r/s % n = a, by lattice reduction. r = sa + mn <-> r/s % n = a
- pyadic.finite_field.univariate_finite_field_solver(equation, root_dict, prime)
Returns all possible solutions of ‘equation’ over a finite field of cardinality ‘prime’. If already satisfied returns True, if no solution exists returns False.
- pyadic.finite_field.update_root_dict(symbol, solutions, root_dict)
Given solutions and root_dict returns updated root_dicts.
- pyadic.finite_field.vec_ModP(prime, optimize_for_sparse_arrays=True)
Vectorized version of ModP.
- pyadic.finite_field.vec_chained_FF_rationalize(tensors, primes, factor=1, algorithm=<function LGRR>, optimize_for_sparse_arrays=True)
Given list of tensors respectively mod primes, returns the rationalized tensor. Keyword argument factor is pre-multiplied and then devided w.r.t. reconstruction, can be used to aid reconstruction or verify its stability.