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

array-api compatability #140

Open
jorenham opened this issue Oct 24, 2024 · 1 comment
Open

array-api compatability #140

jorenham opened this issue Oct 24, 2024 · 1 comment
Labels
meta: array-api Array API compatibility

Comments

@jorenham
Copy link
Owner

jorenham commented Oct 24, 2024

Typing the array API

Our best bet for proper array-api types is optype, but that doesn't exist yet, see jorenham/optype#25. There, I also explain why the official array api "stubs" (which aren't stubs) are completely useless...

Relevant scipy bits

The Array API is partially supported scipy. The following packages support is fully:

  • scipy.cluster
  • scipy.constants (trivial)
  • scipy.datasets (trivial)
  • scipy.fft
    • [i][r|h]fft[2|n]
    • [i]dct[n]
    • [i]dst[n]
    • [r]fftfreq
    • [i]fftshift
  • scipy.io
  • scipy.ndimage

Additionally, the following scipy.special functions have array api support:

  • log_ndtr
  • ndtr
  • ndtri
  • chdtrc
  • erf
  • erfc
  • i0
  • i0e
  • i1
  • i1e
  • gammaln
  • gammainc
  • gammaincc
  • logit
  • expit
  • entr
  • rel_entr
  • xlogy

as well as the following scipy.stats functions:

  • describe
  • moment
  • skew
  • kurtosis
  • kstat
  • kstatvar
  • circmean
  • circvar
  • circstd
  • entropy
  • variation
  • sem
  • ttest_1samp
  • pearsonr
  • chisquare
  • skewtest
  • kurtosistest
  • normaltest
  • jarque_bera
  • bartlett
  • power_divergence
  • monte_carlo_test

How Scipy implements it

Internally, scipy implements the support in scipy._lib._array_api. From the looks of it, this module will come with a bunch of extra utility functions in scipy 1.15 (37174ad), as well as an additional scipy._lib._array_api_no_0d module in 281a8c3

Libraries that support it

Some libraries require array-api-compat for them to support the array-api (2022):

the following libraries have native support:

Other relevant links:

@jorenham jorenham added the meta: array-api Array API compatibility label Oct 25, 2024
@jorenham
Copy link
Owner Author

jorenham/optype#170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta: array-api Array API compatibility
Projects
None yet
Development

No branches or pull requests

1 participant