{ } Raw JSON

bundles / scipy 1.17.1 / scipy / interpolate / _rbfinterp_xp

module

scipy.interpolate._rbfinterp_xp

source: /scipy/interpolate/_rbfinterp_xp.py :0

Members

Summary

'Generic' Array API backend for RBF interpolation.

Extended Summary

The general logic is this: _rbfinterp.py implements the user API and calls into either _rbfinterp_np (the "numpy backend"), or _rbfinterp_xp (the "generic backend".

The numpy backend offloads performance-critical computations to the pythran-compiled _rbfinterp_pythran extension. This way, the call chain is

_rbfinterp.py <-- _rbfinterp_np.py <-- _rbfinterp_pythran.py

The "generic" backend here is a drop-in replacement of the API of _rbfinterp_np.py for use in _rbfinterp.py with non-numpy arrays.

The implementation closely follows _rbfinterp_np + _rbfinterp_pythran, with the following differences:

  • We used vectorized code not explicit loops in _build_system and _build_evaluation_coefficients; this is more torch/jax friendly;

  • RBF kernels are also "vectorized" and not scalar: they receive an array of norms not a single norm;

  • RBF kernels accept an extra xp= argument;

In general, we would prefer less code duplication. The main blocker ATM is that pythran cannot compile functions with an xp= argument where xp is numpy.

Additional content

'Generic' Array API backend for RBF interpolation.

The general logic is this: _rbfinterp.py implements the user API and calls into either _rbfinterp_np (the "numpy backend"), or _rbfinterp_xp (the "generic backend".

The numpy backend offloads performance-critical computations to the pythran-compiled _rbfinterp_pythran extension. This way, the call chain is

_rbfinterp.py <-- _rbfinterp_np.py <-- _rbfinterp_pythran.py

The "generic" backend here is a drop-in replacement of the API of _rbfinterp_np.py for use in _rbfinterp.py with non-numpy arrays.

The implementation closely follows _rbfinterp_np + _rbfinterp_pythran, with the following differences:

  • We used vectorized code not explicit loops in _build_system and _build_evaluation_coefficients; this is more torch/jax friendly;

  • RBF kernels are also "vectorized" and not scalar: they receive an array of norms not a single norm;

  • RBF kernels accept an extra xp= argument;

In general, we would prefer less code duplication. The main blocker ATM is that pythran cannot compile functions with an xp= argument where xp is numpy.

Aliases

  • scipy.interpolate._rbfinterp_xp