scipy.fft.set_global_backend

scipy.fft.set_global_backend(backend, coerce=False, only=False, try_last=False)[source]

Sets the global fft backend

This utility method replaces the default backend for permanent use. It will be tried in the list of backends automatically, unless the only flag is set on a backend. This will be the first tried backend outside the set_backend context manager.

Parameters
backend{object, ‘scipy’}

The backend to use. Can either be a str containing the name of a known backend {‘scipy’} or an object that implements the uarray protocol.

coercebool

Whether to coerce input types when trying this backend.

onlybool

If True, no more backends will be tried if this fails. Implied by coerce=True.

try_lastbool

If True, the global backend is tried after registered backends.

Raises
ValueError: If the backend does not implement numpy.scipy.fft.

Notes

This will overwrite the previously set global backend, which, by default, is the SciPy implementation.

Examples

We can set the global fft backend:

>>> from scipy.fft import fft, set_global_backend
>>> set_global_backend("scipy")  # Sets global backend. "scipy" is the default backend.
>>> fft([1])  # Calls the global backend
array([1.+0.j])