Skip to content

Bugfix/remove axes #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2019
Merged

Bugfix/remove axes #38

merged 2 commits into from
Apr 16, 2019

Conversation

oleksandr-pavlyk
Copy link
Contributor

Closes #37.

As noted by @Jeitan, the logic in _remove_axis was incorrect.

Now:

(b_mkl_fft) [13:28:08 fxsatlin03 mkl_fft]$ ipython
Python 3.6.8 |Intel Corporation| (default, Jan 16 2019, 05:23:57)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import numpy as np, mkl_fft

In [2]: x = np.random.randn(64, 512, 512)

In [3]: %time z = np.fft.fftpack.rfftn(x, axes=[2, 1, 0])
CPU times: user 3.98 s, sys: 724 ms, total: 4.7 s
Wall time: 1.12 s

In [4]: %time w = mkl_fft.rfftn_numpy(x, axes=[2, 1, 0])
CPU times: user 660 ms, sys: 92 ms, total: 752 ms
Wall time: 47.3 ms

In [5]: np.allclose(w, z)
Out[5]: True

See #37

As noted by the reported, the logic of _remove_axes was not right.
We always have to remove the last axis (since _cook_nd_args rearranges
it that way), but upon remove of the axis, we have to decrease all
the axis higher than the pivot by one, since we take part at the pivot.
@oleksandr-pavlyk oleksandr-pavlyk merged commit 01ad727 into master Apr 16, 2019
@oleksandr-pavlyk oleksandr-pavlyk deleted the bugfix/remove-axes branch April 16, 2019 20:24
@charris
Copy link

charris commented Apr 16, 2019

@oleksandr-pavlyk Maybe pass that test back to NumPy, I don't think it is MKL specific.

@oleksandr-pavlyk
Copy link
Contributor Author

@charris Sure thing. I will open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mkl_fft._pydfti.rfftn_numpy error when using axes specification
2 participants