Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move genus method to libsingular in function field #38369

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

fchapoton
Copy link
Contributor

switch the genus method to use libsingular

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.

@fchapoton fchapoton changed the title move one method to libsingular in function field move genus method to libsingular in function field Jul 14, 2024
Copy link

Documentation preview for this PR (built with commit a3c8d42; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@kwankyu
Copy link
Collaborator

kwankyu commented Jul 15, 2024

On my system:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^3 - (x^3 + 2*x*y + 1/x))
sage: self = L
sage: from sage.libs.singular.function import singular_function, lib as singular_lib
....: # making the auxiliary ring which only has polynomials
....: # with integral coefficients.
....: tmpAuxRing = PolynomialRing(self._base_field.constant_field(),
....:     str(self._base_field.gen()) + ',' + str(self._ring.gen()))
....: intMinPoly, d = self._make_monic_integral(self._polynomial)
....: curveIdeal = tmpAuxRing.ideal(intMinPoly)
....: 
sage: singular_lib('normal.lib')  # loading genus method in Singular
sage: genus = singular_function("genus")
sage: from sage.interfaces.singular import singular
sage: singular.lib('normal.lib')  # loading genus method in Singular 
sage: timeit('genus(curveIdeal)')
5 loops, best of 3: 62.5 ms per loop
sage: timeit('int(curveIdeal._singular_().genus())')
25 loops, best of 3: 20.3 ms per loop
sage: timeit('genus(curveIdeal)')
5 loops, best of 3: 62.4 ms per loop
sage: timeit('int(curveIdeal._singular_().genus())')
25 loops, best of 3: 20.4 ms per loop

@fchapoton
Copy link
Contributor Author

damn.. This is a bit schoking..

@kwankyu
Copy link
Collaborator

kwankyu commented Jul 15, 2024

Yeah.. That is against my expectation too :-(

@kwankyu
Copy link
Collaborator

kwankyu commented Jul 15, 2024

We may be just unlucky -- The example may be too small. I didn't try other examples.

@fchapoton
Copy link
Contributor Author

on my system (ubuntu Linux 22.04), with your exemple :

sage: timeit('genus(curveIdeal)')
5 loops, best of 3: 15.7 ms per loop
sage: timeit('int(curveIdeal._singular_().genus())')
25 loops, best of 3: 16.1 ms per loop
sage: timeit('genus(curveIdeal)')
25 loops, best of 3: 15.6 ms per loop
sage: timeit('int(curveIdeal._singular_().genus())')
25 loops, best of 3: 16.2 ms per loop

so libsingular wins for me by a small amount..

@kwankyu
Copy link
Collaborator

kwankyu commented Jul 15, 2024

My system is mac. Unfortunately, the loss on mac is much more significant than the gain on linux...

@tscrim @mkoeppe: how about on your system?

@fchapoton
Copy link
Contributor Author

This may hint at a serious underlying speed issue for libsingular on mac ?

@fchapoton fchapoton marked this pull request as draft August 26, 2024 07:14
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