diff options
| author | Ross Barnowski <rossbar@berkeley.edu> | 2020-08-17 23:16:50 -0700 |
|---|---|---|
| committer | Ross Barnowski <rossbar@berkeley.edu> | 2020-08-17 23:16:50 -0700 |
| commit | 64847eddebe1bd933504c9daa61477e04ff59197 (patch) | |
| tree | d9fc09cfe1dbc6b7ce32ccab7259db0a3bcb6f77 /numpy/fft/_pocketfft.py | |
| parent | e03d99dd780f11b0ab760cab89e5020a63af869a (diff) | |
| download | numpy-64847eddebe1bd933504c9daa61477e04ff59197.tar.gz | |
DOC: update rfft2/irfft2 examples.
Update rfft2 example to conform to fft2 example and switch the irfft2
example to illustrate round-tripping.
Diffstat (limited to 'numpy/fft/_pocketfft.py')
| -rw-r--r-- | numpy/fft/_pocketfft.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/numpy/fft/_pocketfft.py b/numpy/fft/_pocketfft.py index cd972b327..2066b95ea 100644 --- a/numpy/fft/_pocketfft.py +++ b/numpy/fft/_pocketfft.py @@ -1244,13 +1244,13 @@ def rfft2(a, s=None, axes=(-2, -1), norm=None): Examples -------- - >>> a = np.ones((2, 2)) + >>> a = np.mgrid[:5, :5][0] >>> np.fft.rfft2(a) - array([[4.+0.j, 0.+0.j], - [0.+0.j, 0.+0.j]]) - >>> np.fft.rfft2(a, axes=(1, 1)) - array([[2.+0.j, 2.+0.j], - [2.+0.j, 2.+0.j]]) + array([[ 50. +0.j , 0. +0.j , 0. +0.j ], + [-12.5+17.20477401j, 0. +0.j , 0. +0.j ], + [-12.5 +4.0614962j , 0. +0.j , 0. +0.j ], + [-12.5 -4.0614962j , 0. +0.j , 0. +0.j ], + [-12.5-17.20477401j, 0. +0.j , 0. +0.j ]]) """ return rfftn(a, s, axes, norm) @@ -1410,11 +1410,13 @@ def irfft2(a, s=None, axes=(-2, -1), norm=None): Examples -------- - >>> a = np.zeros((3, 3)) - >>> a[0, 0] = 3 * 3 - >>> np.fft.irfft2(a) - array([[0.75, 0.75, 0.75, 0.75], - [0.75, 0.75, 0.75, 0.75], - [0.75, 0.75, 0.75, 0.75]]) + >>> a = np.mgrid[:5, :5][0] + >>> A = np.fft.rfft2(a) + >>> np.fft.irfft2(A, s=a.shape) + array([[0., 0., 0., 0., 0.], + [1., 1., 1., 1., 1.], + [2., 2., 2., 2., 2.], + [3., 3., 3., 3., 3.], + [4., 4., 4., 4., 4.]]) """ return irfftn(a, s, axes, norm) |
