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

Fixes in pyx files #38542

Merged
merged 5 commits into from
Sep 15, 2024
Merged

Fixes in pyx files #38542

merged 5 commits into from
Sep 15, 2024

Conversation

fchapoton
Copy link
Contributor

This is fixing a few issues about division in various cython files.

All the fixes were found using the command cython -a -3 *.pyx.

📝 Checklist

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

Copy link

github-actions bot commented Aug 21, 2024

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

@fchapoton
Copy link
Contributor Author

@kedlaya : could you please have a look at the 2 failing doctests in hypergeometric motives ? I wonder if the old results were correct.

@roed314
Copy link
Contributor

roed314 commented Aug 21, 2024

I just checked in Magma, which agrees with Sage's old results (note that there's a t <-> 1/t difference in convention, thus the 1/2):

H := HypergeometricData([[3],[4]]);
EulerFactor(H,1/2,7);
7*$.1^2 - 3*$.1 + 1

Indeed, 21 is too big since it needs to be a weight 1 Weil polynomial.

@roed314
Copy link
Contributor

roed314 commented Aug 21, 2024

I haven't looked at the code in detail, but I wonder why you even want to change the signature here. It doesn't seem to relate to the C division convention.

@fchapoton
Copy link
Contributor Author

Thanks. So my changes are not good. I will have to investigate. Probably I will undo the changes here about hypergeometric motives.

@fchapoton
Copy link
Contributor Author

fchapoton commented Aug 21, 2024

I wanted to fix the warning displayed by "cython -a -3 hypergeometric_misc.pyx".

    cdef int gl, j, k, l, v, gv
    cdef long long i, q1, w, w1, w2, q2, r, r1
    cdef bint flip, use_longlongs

    q1 = p ** f - 1
                ^
------------------------------------------------------------

sage/modular/hypergeometric_misc.pyx:42:16: Cannot assign type 'double' to 'long long'

@kedlaya
Copy link
Contributor

kedlaya commented Aug 21, 2024

Off the top of my head I am guessing that changing p to unsigned long long is changing the behavior of % down the line. This is of course fixable, let me have a look.

@fchapoton
Copy link
Contributor Author

I have tried to make a smaller change in hgm, and this seems to work. Not sure that it appeases "cython -a -3" buit this is maybe not important

@kedlaya
Copy link
Contributor

kedlaya commented Aug 21, 2024

I have tried to make a smaller change in hgm, and this seems to work. Not sure that it appeases "cython -a -3" buit this is maybe not important

On my end changing only f to be unsigned int seems to fix the warning without disturbing the doctest (which makes sense as the issue is with raising an integer to a possibly negative integer power).

@fchapoton
Copy link
Contributor Author

Thanks. So this is now ready for review.

@fchapoton
Copy link
Contributor Author

please review, if you have time

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise LGTM.

src/sage/combinat/designs/subhypergraph_search.pyx Outdated Show resolved Hide resolved
src/sage/schemes/elliptic_curves/mod_sym_num.pyx Outdated Show resolved Hide resolved
@fchapoton
Copy link
Contributor Author

merci ! Voilà !

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 5, 2024
    
This is fixing a few issues about division in various cython files.

All the fixes were found using the command `cython -a -3 *.pyx`.

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#38542
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 6, 2024
    
This is fixing a few issues about division in various cython files.

All the fixes were found using the command `cython -a -3 *.pyx`.

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#38542
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 8, 2024
    
This is fixing a few issues about division in various cython files.

All the fixes were found using the command `cython -a -3 *.pyx`.

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#38542
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 8, 2024
    
This is fixing a few issues about division in various cython files.

All the fixes were found using the command `cython -a -3 *.pyx`.

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#38542
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 10, 2024
    
This is fixing a few issues about division in various cython files.

All the fixes were found using the command `cython -a -3 *.pyx`.

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#38542
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 12, 2024
    
This is fixing a few issues about division in various cython files.

All the fixes were found using the command `cython -a -3 *.pyx`.

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#38542
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
@vbraun vbraun merged commit 10bb514 into sagemath:develop Sep 15, 2024
15 of 18 checks passed
@fchapoton fchapoton deleted the fixes_in_pyx_files branch September 16, 2024 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants