Opened 2 years ago

Last modified 2 years ago

#23946 new enhancement

Exhaust over Weil polynomials

Reported by: kedlaya Owned by:
Priority: minor Milestone: sage-8.1
Component: number theory Keywords: Weil polynomials, sd91
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: u/kedlaya/exhaust_over_weil_polynomials (Commits) Commit: d12b0ea0aa53cbf558e6ac873414778dd12796a4
Dependencies: #24016 Stopgaps:

Description

I have reasonably stable code (mostly in C, depending on FLINT) for exhausting over Weil polynomials:

https://github.com/kedlaya/root-unitary

The goal of this ticket is to incorporate this code into Sage in some fashion.

Change History (8)

comment:1 follow-up: Changed 2 years ago by kedlaya

  • Dependencies set to #24016

Status update: I've pushed many recent changes to the branch repackage_for_sage of the Github repo. In particular, I have been working to make the call syntax much more transparent; for instance, to compute the Weil polynomials corresponding to abelian varieties of dimension g over the finite field of order q, one can now use standard Python iterator syntax:

sage: wp = WeilPolynomials(2*g, q)
sage: for i in wp:
...

Some to-do items: check that all my old test scripts still work; write more tests; add more documentation; add more input sanitization.

In the meantime, I'd appreciate some feedback about where this might belong in Sage.

comment:2 in reply to: ↑ 1 Changed 2 years ago by jdemeyer

Replying to kedlaya:

In the meantime, I'd appreciate some feedback about where this might belong in Sage.

First of all, your github repo contains both C code and .sage files. Are the .sage files considered to be part of your package or are they really only use cases/examples/tests/documentation?

There are two possibilities, each with its advantages and disadvantages:

(A) Make it an external (presumably optional) package and interface it from Sage.

(B) Make it actually a part of Sage itself.

Advantages of (A) are that you keep control of the package: you can easily change the package at will (with (B) every change would need to go through the Sage Trac) and you don't need to care about Sage coding standards. Also important: with (A) your package could be used without Sage. With (B), there might be more initial work needed to get it into Sage but then it might be less work to maintain.

comment:3 Changed 2 years ago by kedlaya

I just merged a pull request in from another branch, which has the effect of significantly reconfiguring the file structure. In particular, there are no longer any .sage files in the main directory; the ones that exist are all in subdirectories and are indeed examples/tests.

The main code base now consists of two .c files (and their .h headers) and one .pyx file. I still don't have any sort of independent build structure set up; moreover, the .pyx file is more than just a simple wrapper, it is where the parallelism is currently implemented. So at the moment there is really no way to use the code without Sage, and I don't particularly intend to work on making that possible. (Exception: if someone wants to use the code from some other platform like Julia, I'd be willing to cooperate with that.)

comment:4 follow-up: Changed 2 years ago by roed

I think that the code is stable enough that we should just add it to Sage. Maybe create a folder sage/rings/polynomial/weil/ and put them in there?

comment:5 in reply to: ↑ 4 ; follow-up: Changed 2 years ago by kedlaya

Replying to roed:

I think that the code is stable enough that we should just add it to Sage. Maybe create a folder sage/rings/polynomial/weil/ and put them in there?

Do you mean put everything in there? Or put the Cython in sage/rings/polynomials/weil_polynomials.pyx and the C files in sage/rings/polynomial/weil?

Also, if someone can point me to some guidance about a module to the Sage library (e.g., how to format __init__.py and all.py and the like to make the new code discoverable), that would be helpful.

comment:6 in reply to: ↑ 5 Changed 2 years ago by roed

Replying to kedlaya:

Replying to roed:

I think that the code is stable enough that we should just add it to Sage. Maybe create a folder sage/rings/polynomial/weil/ and put them in there?

Do you mean put everything in there? Or put the Cython in sage/rings/polynomials/weil_polynomials.pyx and the C files in sage/rings/polynomial/weil?

I meant putting everything in there. We should also talk about the best way for a user to access these methods; perhaps a method weil_polynomials on ZZ[x] and QQ[x] that returns your iterator?

Also, if someone can point me to some guidance about a module to the Sage library (e.g., how to format __init__.py and all.py and the like to make the new code discoverable), that would be helpful.

See http://doc.sagemath.org/html/en/developer/coding_basics.html#files-and-directory-structure for some details. You'll also need to add lines to src/module_list.py for each extension module.

comment:7 Changed 2 years ago by kedlaya

  • Branch set to u/kedlaya/exhaust_over_weil_polynomials

comment:8 Changed 2 years ago by kedlaya

  • Commit set to d12b0ea0aa53cbf558e6ac873414778dd12796a4

Pushed some partial progress, but this doesn't compile yet.


New commits:

da3d483Add directory src/sage/rings/polynomial/weil/
d12b0eaUpdate module list, all.py
Note: See TracTickets for help on using tickets.