MCPcopy
hub / github.com/dask/dask / func

Function func

dask/array/fft.py:169–211  ·  view source on GitHub ↗
(a, s=None, axes=None, norm=None)

Source from the content-addressed store, hash-verified

167 raise ValueError(f"Given unknown `kind` {kind}.")
168
169 def func(a, s=None, axes=None, norm=None):
170 a = asarray(a)
171 if axes is None:
172 if kind.endswith("2"):
173 axes = (-2, -1)
174 elif kind.endswith("n"):
175 if s is None:
176 axes = tuple(range(a.ndim))
177 else:
178 if NUMPY_GE_200:
179 # Match deprecation in numpy
180 warnings.warn(
181 "DeprecationWarning: `axes` should not be `None` "
182 "if `s` is not `None` (Deprecated in NumPy 2.0)",
183 DeprecationWarning,
184 )
185 axes = tuple(range(len(s)))
186 else:
187 axes = (-1,)
188 elif len(set(axes)) < len(axes):
189 raise ValueError("Duplicate axes not allowed.")
190
191 _dtype = dtype
192 if _dtype is None:
193 sample = np.ones(a.ndim * (8,), dtype=a.dtype)
194 try:
195 _dtype = fft_func(sample, axes=axes, norm=norm).dtype
196 except TypeError:
197 _dtype = fft_func(sample).dtype
198
199 for each_axis in axes:
200 if len(a.chunks[each_axis]) != 1:
201 raise ValueError(chunk_error % (each_axis, a.chunks[each_axis]))
202
203 chunks = out_chunk_fn(a, s, axes)
204
205 args = (s, axes, norm)
206 if kind.endswith("fft"):
207 axis = None if axes is None else axes[0]
208 n = None if s is None else s[0]
209 args = (n, axis, norm)
210
211 return a.map_blocks(fft_func, *args, dtype=_dtype, chunks=chunks)
212
213 if kind.endswith("fft"):
214 _func = func

Callers 15

partial_reduceFunction · 0.70
apply_infer_dtypeFunction · 0.70
_pass_extra_kwargsFunction · 0.70
apply_and_enforceFunction · 0.70
_offsetFunction · 0.70
_parse_wrap_argsFunction · 0.70
_broadcast_trick_innerFunction · 0.70
compute_metaFunction · 0.70
scipy_linalg_safeFunction · 0.70
arg_chunkFunction · 0.70
_prefixscan_combineFunction · 0.70

Calls 4

asarrayFunction · 0.90
setClass · 0.85
onesMethod · 0.45
map_blocksMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…