Skip to content

Single limb floating point $p$-adics#2730

Open
r-mb wants to merge 4 commits into
flintlib:mainfrom
r-mb:padic_nmod
Open

Single limb floating point $p$-adics#2730
r-mb wants to merge 4 commits into
flintlib:mainfrom
r-mb:padic_nmod

Conversation

@r-mb

@r-mb r-mb commented Jun 16, 2026

Copy link
Copy Markdown

This PR implements a new representation for $p$-adic numbers with low precision. This new package uses the floating point representation, as detailed in #2447.

This is not meant as a replacement for the current padic package, as this new approach needs error tracking.

Currently, this PR only implements the most basic arithmetic operations.

@fredrik-johansson

Copy link
Copy Markdown
Collaborator

I think n_remove2_precomp is slow and shouldn't be used for removing (powers of) p.

It's better to use bit manipulation when p = 2 and n_divisible_odd_gm + multiplication by 1/p mod 2^64 when p is odd. This is done in radix (https://github.com/flintlib/flint/blob/main/src/radix/init_clear.c).

Actually I'm wondering if more code reuse between this and radix isn't possible. Hmm.

@fredrik-johansson

Copy link
Copy Markdown
Collaborator

By the way, I think I'm now leaning toward naming the slots u and v (and N for the error), matching padic, which I've also done in padic_radix. This is concise and mnemonic enough.

I think it would be really good to have error tracking built into this module as well.

One option is to have a pair of types (slightly verbose):

  • padic_nmod_float_t / padic_nmod_t
  • padic_nmod_float_t / padic_nmod_ball_t
  • padic_nmod_t / padic_nmod_ball_t

Another option would be to have just one type with floating-point/ball mode selected by the context object. I think this is the right choice for padic_radix if we want to add a floating-point mode there. But for padic_nmod the overhead of 1.5x more storage is not negligible...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants