diff options
| -rw-r--r-- | doc/source/user/c-info.ufunc-tutorial.rst | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/doc/source/user/c-info.ufunc-tutorial.rst b/doc/source/user/c-info.ufunc-tutorial.rst index 3a406479b..47d306f80 100644 --- a/doc/source/user/c-info.ufunc-tutorial.rst +++ b/doc/source/user/c-info.ufunc-tutorial.rst @@ -323,14 +323,15 @@ the primary thing that must be changed to create your own ufunc. PyMODINIT_FUNC PyInit_npufunc(void) { PyObject *m, *logit, *d; + + import_array(); + import_umath(); + m = PyModule_Create(&moduledef); if (!m) { return NULL; } - import_array(); - import_umath(); - logit = PyUFunc_FromFuncAndData(funcs, NULL, types, 1, 1, 1, PyUFunc_None, "logit", "logit_docstring", 0); @@ -576,14 +577,15 @@ is the primary thing that must be changed to create your own ufunc. PyMODINIT_FUNC PyInit_npufunc(void) { PyObject *m, *logit, *d; + + import_array(); + import_umath(); + m = PyModule_Create(&moduledef); if (!m) { return NULL; } - import_array(); - import_umath(); - logit = PyUFunc_FromFuncAndData(funcs, NULL, types, 4, 1, 1, PyUFunc_None, "logit", "logit_docstring", 0); @@ -767,14 +769,15 @@ as well as all other properties of a ufunc. PyMODINIT_FUNC PyInit_npufunc(void) { PyObject *m, *logit, *d; + + import_array(); + import_umath(); + m = PyModule_Create(&moduledef); if (!m) { return NULL; } - import_array(); - import_umath(); - logit = PyUFunc_FromFuncAndData(funcs, NULL, types, 1, 2, 2, PyUFunc_None, "logit", "logit_docstring", 0); @@ -896,15 +899,14 @@ The C file is given below. PyArray_Descr *dtype; PyArray_Descr *dtypes[3]; - m = PyModule_Create(&moduledef); + import_array(); + import_umath(); + m = PyModule_Create(&moduledef); if (m == NULL) { return NULL; } - import_array(); - import_umath(); - /* Create a new ufunc object */ add_triplet = PyUFunc_FromFuncAndData(NULL, NULL, NULL, 0, 2, 1, PyUFunc_None, "add_triplet", |
