summaryrefslogtreecommitdiff
path: root/doc/source/reference/c-api.ufunc.rst
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source/reference/c-api.ufunc.rst')
-rw-r--r--doc/source/reference/c-api.ufunc.rst26
1 files changed, 19 insertions, 7 deletions
diff --git a/doc/source/reference/c-api.ufunc.rst b/doc/source/reference/c-api.ufunc.rst
index 79ad256f5..02a35cf56 100644
--- a/doc/source/reference/c-api.ufunc.rst
+++ b/doc/source/reference/c-api.ufunc.rst
@@ -93,12 +93,23 @@ Functions
the corresponding 1-d loop function in the func array.
:param types:
- Must be of length (*nin* + *nout*) \* *ntypes*, and it
- contains the data-types (built-in only) that the corresponding
- function in the *func* array can deal with.
+ Length ``(nin + nout) * ntypes`` array of ``char`` encoding the
+ :ref:`PyArray_Descr.type_num` (built-in only) that the corresponding
+ function in the ``func`` array accepts. For instance, for a comparison
+ ufunc with three ``ntypes``, two ``nin`` and one ``nout``, where the
+ first function accepts :ref:`npy_int32` and the the second
+ :ref:`npy_int64`, with both returning :ref:`npy_bool`, ``types`` would
+ be ``(char[]) {5, 5, 0, 7, 7, 0}`` since ``NPY_INT32`` is 5,
+ ``NPY_INT64`` is 7, and ``NPY_BOOL`` is 0 (on the python side, these
+ are exposed via :ref:`dtype.num`, i.e., for the example here,
+ ``dtype(np.int32).num``, ``dtype(np.int64).num``, and
+ ``dtype(np.bool_).num``, resp.).
+
+ :ref:`casting-rules` will be used at runtime to find the first
+ ``func`` callable by the input/output provided.
:param ntypes:
- How many different data-type "signatures" the ufunc has implemented.
+ How many different data-type-specific functions the ufunc has implemented.
:param nin:
The number of inputs to this operation.
@@ -129,10 +140,11 @@ Functions
int nin, int nout, int identity, char* name, char* doc, int unused, char *signature)
This function is very similar to PyUFunc_FromFuncAndData above, but has
- an extra *signature* argument, to define generalized universal functions.
+ an extra *signature* argument, to define a
+ :ref:`generalized universal functions <c-api.generalized-ufuncs>`.
Similarly to how ufuncs are built around an element-by-element operation,
- gufuncs are around subarray-by-subarray operations, the signature defining
- the subarrays to operate on.
+ gufuncs are around subarray-by-subarray operations, the
+ :ref:`signature <details-of-signature>` defining the subarrays to operate on.
:param signature:
The signature for the new gufunc. Setting it to NULL is equivalent