diff options
author | Jay Bourque <jay.bourque@continuum.io> | 2013-05-13 10:50:55 -0500 |
---|---|---|
committer | Jay Bourque <jay.bourque@continuum.io> | 2013-05-14 18:02:22 -0500 |
commit | c2f30f9eca1a513601b27d2ae2a9c85d3ad15860 (patch) | |
tree | 29af816e49c4ba70f39ff9bf69f5ab50ba45c54e | |
parent | 84fa1845878c070f190f15e37507bb7575c39d06 (diff) | |
download | numpy-c2f30f9eca1a513601b27d2ae2a9c85d3ad15860.tar.gz |
Change name of RegisterLoopForStructType to RegisterLoopByDescr
-rw-r--r-- | doc/source/reference/c-api.ufunc.rst | 8 | ||||
-rw-r--r-- | doc/source/user/c-info.ufunc-tutorial.rst | 12 | ||||
-rw-r--r-- | numpy/core/code_generators/numpy_api.py | 2 | ||||
-rw-r--r-- | numpy/core/src/umath/struct_ufunc_test.c.src | 10 | ||||
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 15 |
5 files changed, 26 insertions, 21 deletions
diff --git a/doc/source/reference/c-api.ufunc.rst b/doc/source/reference/c-api.ufunc.rst index 1dfc0c6c9..a01f32355 100644 --- a/doc/source/reference/c-api.ufunc.rst +++ b/doc/source/reference/c-api.ufunc.rst @@ -140,13 +140,15 @@ Functions in as *arg_types* which must be a pointer to memory at least as large as ufunc->nargs. -.. cfunction:: int PyUFunc_RegisterLoopForStructType(PyUFuncObject* ufunc, +.. cfunction:: int PyUFunc_RegisterLoopByDescr(PyUFuncObject* ufunc, PyArray_Descr* userdtype, PyUFuncGenericFunction function, PyArray_Descr** arg_dtypes, void* data) This function behaves like PyUFunc_RegisterLoopForType above, except - that it allows the user to register a 1-d loop for structured array - data-dtypes instead of scalar data-types. + that it allows the user to register a 1-d loop using PyArray_Descr + objects instead of dtype type num values. This allows a 1-d loop to be + registered for structured array data-dtypes and custom data-types + instead of scalar data-types. .. cfunction:: int PyUFunc_ReplaceLoopBySignature(PyUFuncObject* ufunc, PyUFuncGenericFunction newfunc, int* signature, diff --git a/doc/source/user/c-info.ufunc-tutorial.rst b/doc/source/user/c-info.ufunc-tutorial.rst index 83a90b887..31ba7984a 100644 --- a/doc/source/user/c-info.ufunc-tutorial.rst +++ b/doc/source/user/c-info.ufunc-tutorial.rst @@ -895,7 +895,7 @@ For the example we show a trivial ufunc for adding two arrays with dtype 'u8,u8,u8'. The process is a bit different from the other examples since a call to PyUFunc_FromFuncAndData doesn't fully register ufuncs for custom dtypes and structured array dtypes. We need to also call -PyUFunc_RegisterLoopForStructType to finish setting up the ufunc. +PyUFunc_RegisterLoopByDescr to finish setting up the ufunc. We only give the C code as the setup.py file is exactly the same as the setup.py file in `Example Numpy ufunc for one dtype`_, except that @@ -1033,11 +1033,11 @@ The C file is given below. dtypes[2] = dtype; /* Register ufunc for structured dtype */ - PyUFunc_RegisterLoopForStructType(add_triplet, - dtype, - &add_uint64_triplet, - dtypes, - NULL); + PyUFunc_RegisterLoopByDescr(add_triplet, + dtype, + &add_uint64_triplet, + dtypes, + NULL); d = PyModule_GetDict(m); diff --git a/numpy/core/code_generators/numpy_api.py b/numpy/core/code_generators/numpy_api.py index ea4ac9f07..2354f532f 100644 --- a/numpy/core/code_generators/numpy_api.py +++ b/numpy/core/code_generators/numpy_api.py @@ -384,7 +384,7 @@ ufunc_funcs_api = { # End 1.6 API 'PyUFunc_DefaultTypeResolver': 39, 'PyUFunc_ValidateCasting': 40, - 'PyUFunc_RegisterLoopForStructType': 41, + 'PyUFunc_RegisterLoopByDescr': 41, } # List of all the dicts which define the C API diff --git a/numpy/core/src/umath/struct_ufunc_test.c.src b/numpy/core/src/umath/struct_ufunc_test.c.src index cc7de1f46..fe3ef0bb1 100644 --- a/numpy/core/src/umath/struct_ufunc_test.c.src +++ b/numpy/core/src/umath/struct_ufunc_test.c.src @@ -106,11 +106,11 @@ PyMODINIT_FUNC initstruct_ufunc_test(void) dtypes[1] = dtype; dtypes[2] = dtype; - PyUFunc_RegisterLoopForStructType(add_triplet, - dtype, - &add_uint64_triplet, - dtypes, - NULL); + PyUFunc_RegisterLoopByDescr(add_triplet, + dtype, + &add_uint64_triplet, + dtypes, + NULL); d = PyModule_GetDict(m); diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index d0c84d6f5..6e7927b89 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -4425,18 +4425,21 @@ _loop1d_list_free(void *ptr) /* - * This function allows the user to register a 1-d loop for structured arrays - * with an already created ufunc. The ufunc is called whenever any of it's input - * arguments match the user_dtype argument. + * This function allows the user to register a 1-d loop with an already + * created ufunc. This function is similar to RegisterLoopForType except + * that it allows a 1-d loop to be registered with PyArray_Descr objects + * instead of dtype type num values. This allows a 1-d loop to be registered + * for a structured array dtype or a custom dtype. The ufunc is called + * whenever any of it's input arguments match the user_dtype argument. * ufunc - ufunc object created from call to PyUFunc_FromFuncAndData - * user_dtype - struct dtype that ufunc will be registered with + * user_dtype - dtype that ufunc will be registered with * function - 1-d loop function pointer - * arg_dtypes - array of struct dtype objects describing the ufunc operands + * arg_dtypes - array of dtype objects describing the ufunc operands * data - arbitrary data pointer passed in to loop function */ /*UFUNC_API*/ NPY_NO_EXPORT int -PyUFunc_RegisterLoopForStructType(PyUFuncObject *ufunc, +PyUFunc_RegisterLoopByDescr(PyUFuncObject *ufunc, PyArray_Descr *user_dtype, PyUFuncGenericFunction function, PyArray_Descr **arg_dtypes, |