Skip to content
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

BUG: ediff1d should return subclasses #8218

Merged
merged 2 commits into from
Oct 28, 2016

Conversation

mattharrigan
Copy link
Contributor

Fixes regression in astropy. Follow up to PR #8183

Special case to_begin and to_end both equal to None, avoiding
subsequent steps.  Particulary faster for small arrays where
overhead plays a big role.
@mattharrigan mattharrigan force-pushed the ediff1d-performance branch 4 times, most recently from f6c519c to 759f943 Compare October 28, 2016 00:16
@mattharrigan
Copy link
Contributor Author

@mhvk can you please test this against astropy? thanks

@mhvk
Copy link
Contributor

mhvk commented Oct 28, 2016

@mattharrigan - yes, this solves the astropy regressions. And as you suggested and I belated realised was true, with the __array_wrap__ it now even works with to_begin and to_end; thanks!!

In [5]: np.ediff1d(np.arange(10.)*u.m, to_begin=1.*u.cm, to_end=1.*u.mm)
Out[5]: 
<Quantity [ 0.01 , 1.   , 1.   , 1.   , 1.   , 1.   , 1.   , 1.   , 1.   ,
            1.   , 0.001] m>

@charris -- I think this is good to go.

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.

3 participants