8000 DOC: Further clarification of c-api. · numpy/numpy@d7f4eef · GitHub
[go: up one dir, main page]

Skip to content

Commit d7f4eef

Browse files
committed
DOC: Further clarification of c-api.
1 parent 69a77fb commit d7f4eef

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

doc/source/reference/c-api.ufunc.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,20 @@ Functions
9393
the corresponding 1-d loop function in the func array.
9494
9595
:param types:
96-
Int8 of length `(nin + nout) * ntypes` It encodes the :ref:`dtype.num`
97-
(built-in only) that the corresponding function in the `func` array
98-
accepts. For a ufunc with two `ntypes`, one `nin` and one `nout` where
99-
the first function accepts and returns `int32` and the second accepts
100-
and returns `int64`, `types` would be `\05\05\07\07` since `int32.num`
101-
is 5 and `int64.num` is 7.
102-
103-
:ref:`casting-rules` will be used at runtime to find the first `func` callable
104-
by the input/output provided.
96+
Length ``(nin + nout) * ntypes`` array of ``char`` encoding the
97+
:ref:`PyArray_Descr.type_num` (built-in only) that the corresponding
98+
function in the ``func`` array accepts. For instance, for a comparison
99+
ufunc with three ``ntypes``, two ``nin`` and one ``nout``, where the
100+
first function accepts :ref:`npy_int32` and the the second
101+
:ref:`npy_int64`, with both returning :ref:`npy_bool`, ``types`` would
102+
be ``(char[]) {5, 5, 0, 7, 7, 0}`` since ``NPY_INT32`` is 5,
103+
``NPY_INT64`` is 7, and ``NPY_BOOL`` is 0 (on the python side, these
104+
are exposed via :ref:`dtype.num`, i.e., for the example here,
105+
``dtype(np.int32).num``, ``dtype(np.int64).num``, and
106+
``dtype(np.bool_).num``, resp.).
107+
108+
:ref:`casting-rules` will be used at runtime to find the first
109+
``func`` callable by the input/output provided.
105110
106111
:param ntypes:
107112
How many different data-type-specific functions the ufunc has implemented.

0 commit comments

Comments
 (0)
0