Issue 37798: Add C fastpath for statistics.NormalDist.inv_cdf() - Python tracker

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: corona10, rhettinger, steven.daprano, taleinat
Priority: normal Keywords: easy (C), patch

Created on 2019-08-09 04:43 by rhettinger, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 15266 merged corona10, 2019-08-14 06:36
PR 15441 merged miss-islington, 2019-08-23 22:20
PR 15453 merged corona10, 2019-08-24 08:37
PR 15467 merged miss-islington, 2019-08-24 17:51
PR 15526 merged rhettinger, 2019-08-26 18:03
PR 15527 merged miss-islington, 2019-08-26 18:26
PR 15546 merged corona10, 2019-08-27 08:58
PR 15660 merged miss-islington, 2019-09-03 09:22
PR 16149 merged rhettinger, 2019-09-14 18:19
PR 16160 merged miss-islington, 2019-09-15 16:37
Messages (18)
msg349273 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-09 04:43
Create new module:  Modules/_statisticsmodule.c

Add a function:    _normal_dist_inv_cdf(p, mu, sigma) |-> x

Mostly, it should be a cut-and-paste from the pure Python version, just add argument processing and semi-colons.

Expect to measure a manyfold speedup.
msg349521 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2019-08-13 05:30
@rhettinger

Hi, Can I work on this issue?
It might be my first C module addition task for CPython.
msg349527 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-13 06:33
> Can I work on this issue?  
> It might be my first C module addition task for CPython.

Yes.  This issue would be a good place to start.
msg350335 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-23 22:20
New changeset 0a18ee4be7ba215f414bef04598e0849504f9f1e by Raymond Hettinger (Dong-hee Na) in branch 'master':
bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266)
https://github.com/python/cpython/commit/0a18ee4be7ba215f414bef04598e0849504f9f1e
msg350336 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-23 22:39
New changeset 5779c536321e1405b4c17654a85b8f9221be765e by Raymond Hettinger (Miss Islington (bot)) in branch '3.8':
bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266) (GH-15441)
https://github.com/python/cpython/commit/5779c536321e1405b4c17654a85b8f9221be765e
msg350337 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-23 22:41
Thanks for doing the work one this.  Nice work :-)

There's one more step.  Can you please amend to the tests to run both the pure python and C versions.  See Lib/test/test_heapq.py for an example of how to this.
msg350338 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2019-08-23 23:22
> There's one more step.  Can you please amend to the tests to run both the
> pure python and C versions.

Sure, I will take look at it!
msg350384 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-24 17:51
New changeset 8ad22a42267d4ecb1c080d420933680cc126363e by Raymond Hettinger (Dong-hee Na) in branch 'master':
bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453)
https://github.com/python/cpython/commit/8ad22a42267d4ecb1c080d420933680cc126363e
msg350389 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-24 18:14
New changeset d5a66bc56f68d0f7cc3470722a31d7f731754af6 by Raymond Hettinger (Miss Islington (bot)) in branch '3.8':
bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453) (GH-15467)
https://github.com/python/cpython/commit/d5a66bc56f68d0f7cc3470722a31d7f731754af6
msg350390 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-24 18:14
Thank you again.  This was nice work.
msg350403 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2019-08-24 22:35
Thank you for the mentoring of this work. 
It was great experience for me!
msg350558 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-26 18:26
New changeset 6fee0f8ea72fa68155a32b33b6c0ed9e5a740e45 by Raymond Hettinger in branch 'master':
bpo-37798: Minor code formatting and comment clean-ups. (GH-15526)
https://github.com/python/cpython/commit/6fee0f8ea72fa68155a32b33b6c0ed9e5a740e45
msg350561 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-26 19:10
New changeset 56c4d2d057de0dcb968148fa1286e587e91f5c91 by Raymond Hettinger (Miss Islington (bot)) in branch '3.8':
bpo-37798: Minor code formatting and comment clean-ups. (GH-15526) (GH-15527)
https://github.com/python/cpython/commit/56c4d2d057de0dcb968148fa1286e587e91f5c91
msg350794 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2019-08-29 16:01
@rhettinger
If you are okay, Can you review PR 15546, please?
IMHO, this issue should be fixed ASAP...
Thanks again
msg351078 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-09-03 09:21
New changeset 0cf832a9ef84be6e18aad02464814530d80b82b2 by Tal Einat (Dong-hee Na) in branch 'master':
bpo-37798: Fix _statistics module doc (GH-15546)
https://github.com/python/cpython/commit/0cf832a9ef84be6e18aad02464814530d80b82b2
msg351079 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-09-03 10:22
New changeset 58067d2cf6e81187f9782aff03cc8bec3d878778 by Tal Einat (Miss Islington (bot)) in branch '3.8':
bpo-37798: Fix _statistics module doc (GH-15546)
https://github.com/python/cpython/commit/58067d2cf6e81187f9782aff03cc8bec3d878778
msg352479 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-09-15 16:36
New changeset 6e27a0d77520bf2c4412e367496212510f81b983 by Raymond Hettinger in branch 'master':
bpo-37798: Prevent undefined behavior in direct calls to the C helper function. (#16149)
https://github.com/python/cpython/commit/6e27a0d77520bf2c4412e367496212510f81b983
msg352481 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-09-15 17:04
New changeset d6fdfc82dd307161ca2222ae938b7a6c85215bc1 by Raymond Hettinger (Miss Islington (bot)) in branch '3.8':
bpo-37798: Prevent undefined behavior in direct calls to the C helper function. (GH-16149) (GH-16160)
https://github.com/python/cpython/commit/d6fdfc82dd307161ca2222ae938b7a6c85215bc1