Skip to content

ENH: __array_function__ support for np.fft and np.linalg #12117

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 4 commits into from
Oct 13, 2018

Conversation

shoyer
Copy link
Member

@shoyer shoyer commented Oct 8, 2018

xref #12028

@shoyer shoyer force-pushed the array-function-numpy-fft-linalg branch from 810508e to 40a5588 Compare October 8, 2018 19:37
@shoyer shoyer changed the title __array_function__ support for np.fft and np.linalg ENH: __array_function__ support for np.fft and np.linalg Oct 8, 2018
Copy link
Contributor

@hameerabbasi hameerabbasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one (particularly linalg) in particular will be useful for PyData/Sparse long term. Thanks for this.

I see that ignoring None is a theme here, so I'm going to ignore it completely in future reviews. I'm sure you carefully considered the pros and cons of such an approach.

Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from my suggestion to make an exception for fft to the rule that every function has its own dispatcher, this looks good.

@@ -101,6 +102,11 @@ def _unitary(norm):
return norm is not None


def _fft_dispatcher(a, n=None, axis=None, norm=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, in this whole file, there are only two signatures: (a, n, axis, norm), and (a, s, axes, norm) - I think in such a well-constructed file, it is a lot clearer to define the two signatures once and use them throughout.

@@ -19,6 +20,11 @@
integer_types = integer_types + (integer,)


def _fftshift_dispatcher(x, axes=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would again suggest just using a single dispatcher.

@charris
Copy link
Member

charris commented Oct 11, 2018

This looks to be still under discussion. Ping when ready.

@charris charris changed the title ENH: __array_function__ support for np.fft and np.linalg WIP, ENH: __array_function__ support for np.fft and np.linalg Oct 11, 2018
@charris
Copy link
Member

charris commented Oct 11, 2018

Remove WIP from title when ready.

@shoyer
Copy link
Member Author

shoyer commented Oct 12, 2018

Yeah, I got a little carried away with copy & paste here. This should be much less repetitive now.

@shoyer shoyer changed the title WIP, ENH: __array_function__ support for np.fft and np.linalg ENH: __array_function__ support for np.fft and np.linalg Oct 12, 2018
@mhvk
Copy link
Contributor

mhvk commented Oct 12, 2018

Well, for fft at least, it is clear what the best option is! I'm quite happy for this to go in.

@shoyer shoyer merged commit 18c1210 into numpy:master Oct 13, 2018
@shoyer shoyer deleted the array-function-numpy-fft-linalg branch October 13, 2018 00:13
@charris charris changed the title ENH: __array_function__ support for np.fft and np.linalg ENH: __array_function__ support for np.fft and np.linalg Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants