Skip to content

BUG: ediff1d should return subclasses - #8218

Merged
charris merged 2 commits into
numpy:masterfrom
mattharrigan:ediff1d-performance
Oct 28, 2016
Merged

charris merged 2 commits into
numpy:masterfrom
mattharrigan:ediff1d-performance

Conversation

@mattharrigan

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

@mhvk can you please test this against astropy? thanks

@mhvk

mhvk commented Oct 28, 2016

Copy link
Copy Markdown
Contributor

@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