Skip to content

ENH: add integer-parameter signature in numpy.h - #219

Merged
dschmitz89 merged 1 commit into
scipy:mainfrom
fbourgey:signature_numpy
Aug 18, 2026
Merged

ENH: add integer-parameter signature in numpy.h#219
dschmitz89 merged 1 commit into
scipy:mainfrom
fbourgey:signature_numpy

Conversation

@fbourgey

Copy link
Copy Markdown
Member

Reference issue

What does this implement/fix?

Following #209, I was trying to use Jacobi and Shifted Jacobi polynomials from XSF. It appears those ufunc signatures will be useful for scipy/special/_special_ufuncs.cpp for Jacobi and the following polynomials.

Additional information

AI Generation Disclosure

Codex reviewed.

@github-actions github-actions Bot added the Enhancement New feature or request label Jul 18, 2026
@fbourgey fbourgey changed the title ENH: add integer-parameter signature ENH: add integer-parameter signature in numpy.h Jul 18, 2026
@fbourgey
fbourgey requested a review from dschmitz89 July 18, 2026 15:31
@dschmitz89

Copy link
Copy Markdown
Contributor

Ay, didn't expect this. @khushi-411 Was there a hard requirement why we need std::ptrdiff_t instead of a regular int for the Jacobi functions?

@khushi-411

Copy link
Copy Markdown
Contributor

Hi, @dschmitz89, @fbourgey! The main reason was that the windows tests were failing in CI when I used a test case with an input value of dtype long so I used std::ptrdiff_t.

From here: #209 (comment)

On 64-bit systems std::ptrdiff_t represents 64 bits whereas long is still 32-bit but for 32-bit systems both represents 32-bits.

Reference: #53 (comment)

@dschmitz89

Copy link
Copy Markdown
Contributor

Hi, @dschmitz89, @fbourgey! The main reason was that the windows tests were failing in CI when I used a test case with an input value of dtype long so I used std::ptrdiff_t.

From here: #209 (comment)

On 64-bit systems std::ptrdiff_t represents 64 bits whereas long is still 32-bit but for 32-bit systems both represents 32-bits.

Reference: #53 (comment)

Thanks for the explanation. To me this looks good then but it would be great if @steppi could take a final look.

@fbourgey

fbourgey commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Hi, @dschmitz89, @fbourgey! The main reason was that the windows tests were failing in CI when I used a test case with an input value of dtype long so I used std::ptrdiff_t.
From here: #209 (comment)

On 64-bit systems std::ptrdiff_t represents 64 bits whereas long is still 32-bit but for 32-bit systems both represents 32-bits.
Reference: #53 (comment)

Thanks for the explanation. To me this looks good then but it would be great if @steppi could take a final look.

@steppi WDYT?

@lucascolley
lucascolley requested a review from steppi August 2, 2026 21:24
@fbourgey

Copy link
Copy Markdown
Member Author

Why not simply use int instead of std::ptrdiff_t? The following fbourgey@4814107 commit seems to pass CI.

@khushi-411

Copy link
Copy Markdown
Contributor

@fbourgey, I thought since int is always 32-bit on both 32-bit and 64-bit systems, so I thought std::ptrdiff_t would be a better choice. What do you think?

@fbourgey

Copy link
Copy Markdown
Member Author

@steppi can you chime in here?

@steppi

steppi commented Aug 18, 2026

Copy link
Copy Markdown
Member

I think it's fine to do this on a temporary basis. Longer term, we should move to only using fixed width types, using templates in the kernels for integer args to support "generic integer arguments", and to have int32 and int64 versions of the loops whenever there are integer args. I'm OK with merging this though.

@dschmitz89
dschmitz89 merged commit 57f71dc into scipy:main Aug 18, 2026
9 checks passed
@github-actions github-actions Bot added the needs-release-note-decision A maintainer should decide if this PR requires a release note. label Aug 18, 2026
@dschmitz89

Copy link
Copy Markdown
Contributor

I think it's fine to do this on a temporary basis. Longer term, we should move to only using fixed width types, using templates in the kernels for integer args to support "generic integer arguments", and to have int32 and int64 versions of the loops whenever there are integer args. I'm OK with merging this though.

@steppi Would you have time to open a PR that show cases the template approach for the Jacobi polynomials? If that is the preferred route we should use it now already if it is not too complicated.

@fbourgey
fbourgey deleted the signature_numpy branch August 18, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request needs-release-note-decision A maintainer should decide if this PR requires a release note.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants