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

bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() #15266

Merged
merged 1 commit into from
Aug 23, 2019

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Aug 14, 2019

Lib/statistics.py Outdated Show resolved Hide resolved
@corona10 corona10 changed the title bpo-37998: Add C fastpath for statistics.NormalDist.inv_cdf() bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() Aug 14, 2019
@corona10 corona10 force-pushed the bpo-37798 branch 4 times, most recently from 5a77376 to ba81a90 Compare August 14, 2019 08:51
@rhettinger
Copy link
Contributor

The usual way we do this is to define the function in pure python. Then, somewhere below that definition, try to import the C accelerator function in its place. For examples, see line 458 in Lib/collections/__init__.py for _count_elements() or line 579 in Lib/heapq.py

@corona10
Copy link
Member Author

@rhettinger

Thanks a lot.
I 've updated the PR as you suggested.
I both test when using pure python version and C version.
And it looks same on both versions.
Please take a look.

Lib/statistics.py Outdated Show resolved Hide resolved
Modules/_statisticsmodule.c Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@corona10
Copy link
Member Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@rhettinger: please review the changes made to this pull request.

@corona10
Copy link
Member Author

@rhettinger Can you please take a look?

Lib/statistics.py Outdated Show resolved Hide resolved
Modules/_statisticsmodule.c Outdated Show resolved Hide resolved
Modules/_statisticsmodule.c Outdated Show resolved Hide resolved
Modules/_statisticsmodule.c Show resolved Hide resolved
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@rhettinger
Copy link
Contributor

Thanks for doing this. I think we're getting close :-)

@corona10
Copy link
Member Author

Thanks for the review, I will take look at!

@corona10
Copy link
Member Author

@rhettinger I've updated the PR!

@miss-islington
Copy link
Contributor

Thanks @corona10 for the PR, and @rhettinger for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-15441 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 23, 2019
…GH-15266)

(cherry picked from commit 0a18ee4)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
@rhettinger
Copy link
Contributor

Nice work. Thanks for doing this :-)

rhettinger pushed a commit that referenced this pull request Aug 23, 2019
…) (GH-15441)

(cherry picked from commit 0a18ee4)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
@corona10 corona10 deleted the bpo-37798 branch August 24, 2019 06:03
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
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.

6 participants