summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2019-08-23 22:20:30 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2019-08-23 22:20:30 (GMT)
commit0a18ee4be7ba215f414bef04598e0849504f9f1e (patch)
tree02b4a3f5f9cd481ce73e4aa934b5bf13b600504a /Modules/clinic
parent5be666010e4df65dc4d831435cc92340ea369f94 (diff)
downloadcpython-0a18ee4be7ba215f414bef04598e0849504f9f1e.zip
cpython-0a18ee4be7ba215f414bef04598e0849504f9f1e.tar.gz
cpython-0a18ee4be7ba215f414bef04598e0849504f9f1e.tar.bz2
bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266)
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/_statisticsmodule.c.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/Modules/clinic/_statisticsmodule.c.h b/Modules/clinic/_statisticsmodule.c.h
new file mode 100644
index 0000000..f5a2e46
--- /dev/null
+++ b/Modules/clinic/_statisticsmodule.c.h
@@ -0,0 +1,50 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_statistics__normal_dist_inv_cdf__doc__,
+"_normal_dist_inv_cdf($module, p, mu, sigma, /)\n"
+"--\n"
+"\n");
+
+#define _STATISTICS__NORMAL_DIST_INV_CDF_METHODDEF \
+ {"_normal_dist_inv_cdf", (PyCFunction)(void(*)(void))_statistics__normal_dist_inv_cdf, METH_FASTCALL, _statistics__normal_dist_inv_cdf__doc__},
+
+static double
+_statistics__normal_dist_inv_cdf_impl(PyObject *module, double p, double mu,
+ double sigma);
+
+static PyObject *
+_statistics__normal_dist_inv_cdf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ double p;
+ double mu;
+ double sigma;
+ double _return_value;
+
+ if (!_PyArg_CheckPositional("_normal_dist_inv_cdf", nargs, 3, 3)) {
+ goto exit;
+ }
+ p = PyFloat_AsDouble(args[0]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+ mu = PyFloat_AsDouble(args[1]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+ sigma = PyFloat_AsDouble(args[2]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+ _return_value = _statistics__normal_dist_inv_cdf_impl(module, p, mu, sigma);
+ if ((_return_value == -1.0) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyFloat_FromDouble(_return_value);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=ba6af124acd34732 input=a9049054013a1b77]*/