| Server IP : 93.86.61.54 / Your IP : 216.73.216.156 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/scipy/fft/__pycache__/ |
Upload File : |
o
��Eb� � @ sp d dl m mZ ddlmZ G dd� d�ZdeiZdd� Zdd
d�Z dd
� Z
ddd�Zdd� Ze ddd� dS )� N� )�
_pocketfftc @ s e Zd ZdZdZedd� �ZdS )�
_ScipyBackenda- The default backend for fft calculations
Notes
-----
We use the domain ``numpy.scipy`` rather than ``scipy`` because ``uarray``
treats the domain as a hierarchy. This means the user can install a single
backend for ``numpy`` and have it implement ``numpy.scipy.fft`` as well.
�numpy.scipy.fftc C s( t t| jd �}|d u r
tS ||i |��S )N)�getattrr �__name__�NotImplemented)�method�args�kwargs�fn� r
�4/usr/lib/python3/dist-packages/scipy/fft/_backend.py�__ua_function__ s z_ScipyBackend.__ua_function__N)r �
__module__�__qualname__�__doc__�
__ua_domain__�staticmethodr r
r
r
r r s
r �scipyc
C sV t | t�r zt| } W n ty } ztd�| ��|�d}~ww | jdkr)td��| S )z8Maps strings to known backends and validates the backendzUnknown backend {}Nr z,Backend does not implement "numpy.scipy.fft")�
isinstance�str�_named_backends�KeyError�
ValueError�formatr )�backend�er
r
r �_backend_from_arg s
��
r Fc C s t | �} tj| |||d� dS )a7 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 :obj:`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.
coerce : bool
Whether to coerce input types when trying this backend.
only : bool
If ``True``, no more backends will be tried if this fails.
Implied by ``coerce=True``.
try_last : bool
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])
)�coerce�only�try_lastN)r �ua�set_global_backend)r r r r! r
r
r r# - s (r# c C s t | �} t�| � dS )az
Register a backend for permanent use.
Registered backends have the lowest priority and will be tried after the
global backend.
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.
Raises
------
ValueError: If the backend does not implement ``numpy.scipy.fft``.
Examples
--------
We can register a new fft backend:
>>> from scipy.fft import fft, register_backend, set_global_backend
>>> class NoopBackend: # Define an invalid Backend
... __ua_domain__ = "numpy.scipy.fft"
... def __ua_function__(self, func, args, kwargs):
... return NotImplemented
>>> set_global_backend(NoopBackend()) # Set the invalid backend as global
>>> register_backend("scipy") # Register a new backend
>>> fft([1]) # The registered backend is called because the global backend returns `NotImplemented`
array([1.+0.j])
>>> set_global_backend("scipy") # Restore global backend to default
N)r r"