|
51 | 51 | __all__ = [
|
52 | 52 | "fft",
|
53 | 53 | "fft2",
|
| 54 | + "fftfreq", |
54 | 55 | "fftn",
|
| 56 | + "fftshift", |
| 57 | + "hfft", |
55 | 58 | "ifft",
|
56 | 59 | "ifft2",
|
57 | 60 | "ifftn",
|
| 61 | + "ifftshift", |
| 62 | + "ihfft", |
58 | 63 | "irfft",
|
59 | 64 | "irfft2",
|
60 | 65 | "irfftn",
|
61 | 66 | "rfft",
|
62 | 67 | "rfft2",
|
| 68 | + "rfftfreq", |
63 | 69 | "rfftn"
|
64 | 70 | ]
|
65 | 71 |
|
@@ -132,6 +138,21 @@ def fft2(x1, s=None, axes=(-2, -1), norm=None):
|
132 | 138 | return call_origin(numpy.fft.fft2, x1, s, axes, norm)
|
133 | 139 |
|
134 | 140 |
|
| 141 | +def fftfreq(n=None, d=1.0): |
| 142 | + """ |
| 143 | + Compute the one-dimensional discrete Fourier Transform sample frequencies. |
| 144 | +
|
| 145 | + Limitations |
| 146 | + ----------- |
| 147 | + Parameter ``d`` is unsupported. |
| 148 | +
|
| 149 | + For full documentation refer to :obj:`numpy.fft.fftfreq`. |
| 150 | +
|
| 151 | + """ |
| 152 | + |
| 153 | + return call_origin(numpy.fft.fftfreq, n, d) |
| 154 | + |
| 155 | + |
135 | 156 | def fftn(x1, s=None, axes=None, norm=None):
|
136 | 157 | """
|
137 | 158 | Compute the N-dimensional FFT.
|
@@ -181,6 +202,77 @@ def fftn(x1, s=None, axes=None, norm=None):
|
181 | 202 | return call_origin(numpy.fft.fftn, x1, s, axes, norm)
|
182 | 203 |
|
183 | 204 |
|
| 205 | +def fftshift(x1, axes=None): |
| 206 | + """ |
| 207 | + Shift the zero-frequency component to the center of the spectrum. |
| 208 | +
|
| 209 | + Limitations |
| 210 | + ----------- |
| 211 | + Parameter ``axes`` is unsupported. |
| 212 | + Parameter ``x1`` supports ``dpnp.int32``, ``dpnp.int64``, ``dpnp.float32``, ``dpnp.float64`` and |
| 213 | + ``dpnp.complex128`` datatypes only. |
| 214 | +
|
| 215 | + For full documentation refer to :obj:`numpy.fft.fftshift`. |
| 216 | +
|
| 217 | + """ |
| 218 | + |
| 219 | + is_x1_dparray = isinstance(x1, dparray) |
| 220 | + |
| 221 | + if (not use_origin_backend(x1) and is_x1_dparray and 0): |
| 222 | + if axis is None: |
| 223 | + axis_param = -1 # the most right dimension (default value) |
| 224 | + else: |
| 225 | + axis_param = axes |
| 226 | + |
| 227 | + if x1.size < 1: |
| 228 | + pass # let fallback to handle exception |
| 229 | + else: |
| 230 | + return dpnp_fft(x1, input_boundarie, output_boundarie, axis_param, False) |
| 231 | + |
| 232 | + return call_origin(numpy.fft.fftshift, x1, axes) |
| 233 | + |
| 234 | + |
| 235 | +def hfft(x1, n=None, axis=-1, norm=None): |
| 236 | + """ |
| 237 | + Compute the one-dimensional discrete Fourier Transform of a signal that has Hermitian symmetry. |
| 238 | +
|
| 239 | + Limitations |
| 240 | + ----------- |
| 241 | + Parameter ``norm`` is unsupported. |
| 242 | + Parameter ``x1`` supports ``dpnp.int32``, ``dpnp.int64``, ``dpnp.float32``, ``dpnp.float64`` and |
| 243 | + ``dpnp.complex128`` datatypes only. |
| 244 | +
|
| 245 | + For full documentation refer to :obj:`numpy.fft.hfft`. |
| 246 | +
|
| 247 | + """ |
| 248 | + |
| 249 | + is_x1_dparray = isinstance(x1, dparray) |
| 250 | + |
| 251 | + if (not use_origin_backend(x1) and is_x1_dparray and 0): |
| 252 | + if axis is None: |
| 253 | + axis_param = -1 # the most right dimension (default value) |
| 254 | + else: |
| 255 | + axis_param = axis |
| 256 | + |
| 257 | + if n is None: |
| 258 | + input_boundarie = x1.shape[axis_param] |
| 259 | + else: |
| 260 | + input_boundarie = n |
| 261 | + |
| 262 | + if x1.size < 1: |
| 263 | + pass # let fallback to handle exception |
| 264 | + elif input_boundarie < 1: |
| 265 | + pass # let fallback to handle exception |
| 266 | + elif norm is not None: |
| 267 | + pass |
| 268 | + else: |
| 269 | + output_boundarie = input_boundarie |
| 270 | + |
| 271 | + return dpnp_fft(x1, input_boundarie, output_boundarie, axis_param, False) |
| 272 | + |
| 273 | + return call_origin(numpy.fft.hfft, x1, n, axis, norm) |
| 274 | + |
| 275 | + |
184 | 276 | def ifft(x1, n=None, axis=-1, norm=None):
|
185 | 277 | """
|
186 | 278 | Compute the one-dimensional inverse discrete Fourier Transform.
|
@@ -249,6 +341,36 @@ def ifft2(x1, s=None, axes=(-2, -1), norm=None):
|
249 | 341 | return call_origin(numpy.fft.ifft2, x1, s, axes, norm)
|
250 | 342 |
|
251 | 343 |
|
| 344 | +def ifftshift(x1, axes=None): |
| 345 | + """ |
| 346 | + Inverse shift the zero-frequency component to the center of the spectrum. |
| 347 | +
|
| 348 | + Limitations |
| 349 | + ----------- |
| 350 | + Parameter ``axes`` is unsupported. |
| 351 | + Parameter ``x1`` supports ``dpnp.int32``, ``dpnp.int64``, ``dpnp.float32``, ``dpnp.float64`` and |
| 352 | + ``dpnp.complex128`` datatypes only. |
| 353 | +
|
| 354 | + For full documentation refer to :obj:`numpy.fft.ifftshift`. |
| 355 | +
|
| 356 | + """ |
| 357 | + |
| 358 | + is_x1_dparray = isinstance(x1, dparray) |
| 359 | + |
| 360 | + if (not use_origin_backend(x1) and is_x1_dparray and 0): |
| 361 | + if axis is None: |
| 362 | + axis_param = -1 # the most right dimension (default value) |
| 363 | + else: |
| 364 | + axis_param = axes |
| 365 | + |
| 366 | + if x1.size < 1: |
| 367 | + pass # let fallback to handle exception |
| 368 | + else: |
| 369 | + return dpnp_fft(x1, input_boundarie, output_boundarie, axis_param, False) |
| 370 | + |
| 371 | + return call_origin(numpy.fft.ifftshift, x1, axes) |
| 372 | + |
| 373 | + |
252 | 374 | def ifftn(x1, s=None, axes=None, norm=None):
|
253 | 375 | """
|
254 | 376 | Compute the N-dimensional inverse discrete Fourier Transform.
|
@@ -298,6 +420,47 @@ def ifftn(x1, s=None, axes=None, norm=None):
|
298 | 420 | return call_origin(numpy.fft.ifftn, x1, s, axes, norm)
|
299 | 421 |
|
300 | 422 |
|
| 423 | +def ihfft(x1, n=None, axis=-1, norm=None): |
| 424 | + """ |
| 425 | + Compute inverse one-dimensional discrete Fourier Transform of a signal that has Hermitian symmetry. |
| 426 | +
|
| 427 | + Limitations |
| 428 | + ----------- |
| 429 | + Parameter ``norm`` is unsupported. |
| 430 | + Parameter ``x1`` supports ``dpnp.int32``, ``dpnp.int64``, ``dpnp.float32``, ``dpnp.float64`` and |
| 431 | + ``dpnp.complex128`` datatypes only. |
| 432 | +
|
| 433 | + For full documentation refer to :obj:`numpy.fft.ihfft`. |
| 434 | +
|
| 435 | + """ |
| 436 | + |
| 437 | + is_x1_dparray = isinstance(x1, dparray) |
| 438 | + |
| 439 | + if (not use_origin_backend(x1) and is_x1_dparray and 0): |
| 440 | + if axis is None: |
| 441 | + axis_param = -1 # the most right dimension (default value) |
| 442 | + else: |
| 443 | + axis_param = axis |
| 444 | + |
| 445 | + if n is None: |
| 446 | + input_boundarie = x1.shape[axis_param] |
| 447 | + else: |
| 448 | + input_boundarie = n |
| 449 | + |
| 450 | + if x1.size < 1: |
| 451 | + pass # let fallback to handle exception |
| 452 | + elif input_boundarie < 1: |
| 453 | + pass # let fallback to handle exception |
| 454 | + elif norm is not None: |
| 455 | + pass |
| 456 | + else: |
| 457 | + output_boundarie = input_boundarie |
| 458 | + |
| 459 | + return dpnp_fft(x1, input_boundarie, output_boundarie, axis_param, False) |
| 460 | + |
| 461 | + return call_origin(numpy.fft.ihfft, x1, n, axis, norm) |
| 462 | + |
| 463 | + |
301 | 464 | def irfft(x1, n=None, axis=-1, norm=None):
|
302 | 465 | """
|
303 | 466 | Compute the one-dimensional inverse discrete Fourier Transform for real input..
|
@@ -487,6 +650,21 @@ def rfft2(x1, s=None, axes=(-2, -1), norm=None):
|
487 | 650 | return call_origin(numpy.fft.rfft2, x1, s, axes, norm)
|
488 | 651 |
|
489 | 652 |
|
| 653 | +def rfftfreq(n=None, d=1.0): |
| 654 | + """ |
| 655 | + Compute the one-dimensional discrete Fourier Transform sample frequencies. |
| 656 | +
|
| 657 | + Limitations |
| 658 | + ----------- |
| 659 | + Parameter ``d`` is unsupported. |
| 660 | +
|
| 661 | + For full documentation refer to :obj:`numpy.fft.rfftfreq`. |
| 662 | +
|
| 663 | + """ |
| 664 | + |
| 665 | + return call_origin(numpy.fft.rfftfreq, n, d) |
| 666 | + |
| 667 | + |
490 | 668 | def rfftn(x1, s=None, axes=None, norm=None):
|
491 | 669 | """
|
492 | 670 | Compute the N-dimensional discrete Fourier Transform for real input.
|
|
0 commit comments