summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2021-05-03 16:00:58 -0500
committerSebastian Berg <sebastian@sipsolutions.net>2021-05-03 16:00:58 -0500
commit127b1a7cd9a139ad244f6ee62aeb1ba3cec3a4a1 (patch)
tree7042093fbfbcb8c506424f0a9318f02a82f71975 /doc/source
parent8d4828f8da96187a9263fd1573ee74ced6a3eedb (diff)
downloadnumpy-127b1a7cd9a139ad244f6ee62aeb1ba3cec3a4a1.tar.gz
DOC,API: Fix the documentation.
Also, for now enforce *all* outputs. That is more conservative, and obviously won't work for certain functions in scipy that have multiple outputs of different types, but it seems a bit safer to me right now. Maybe at some point we have an idea of how to "modify" what the `dtype` means. I am not sure how! By allowing the ufunc itself to interpret how to translte it to a `signature`? By giving it a distinct meaning? Yes, this might narrow us down a bit... but...
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/reference/ufuncs.rst44
1 files changed, 28 insertions, 16 deletions
diff --git a/doc/source/reference/ufuncs.rst b/doc/source/reference/ufuncs.rst
index c919ec9b8..000c7da89 100644
--- a/doc/source/reference/ufuncs.rst
+++ b/doc/source/reference/ufuncs.rst
@@ -430,8 +430,10 @@ advanced usage and will not typically be used.
.. versionadded:: 1.6
- Overrides the dtype of the calculation and output arrays. Similar to
- *signature*.
+ Overrides the DType of the output arrays the same way as the *signature*.
+ This should ensure a matching precision of the calculation. The exact
+ calculation DTypes chosen may depend on the ufunc and the inputs may be
+ cast to this DType to perform the calculation.
*subok*
@@ -442,20 +444,30 @@ advanced usage and will not typically be used.
*signature*
- Either a data-type, a tuple of data-types, or a special signature
- string indicating the input and output types of a ufunc. This argument
- allows you to provide a specific signature for the 1-d loop to use
- in the underlying calculation. If the loop specified does not exist
- for the ufunc, then a TypeError is raised. Normally, a suitable loop is
- found automatically by comparing the input types with what is
- available and searching for a loop with data-types to which all inputs
- can be cast safely. This keyword argument lets you bypass that
- search and choose a particular loop. A list of available signatures is
- provided by the **types** attribute of the ufunc object. For backwards
- compatibility this argument can also be provided as *sig*, although
- the long form is preferred. Note that this should not be confused with
- the generalized ufunc :ref:`signature <details-of-signature>` that is
- stored in the **signature** attribute of the of the ufunc object.
+ Either a Dtype, a tuple of DTypes, or a special signature string
+ indicating the input and output types of a ufunc.
+
+ This arguments allows to specify exact DTypes to be used for the
+ calculation. Casting will be used as necessary and the input DType
+ is not used unless ``signature`` is ``None`` for that input.
+
+ When all DTypes are fixed, a specific loop is chosen or an error raised
+ if no matching loop does not exist.
+ If some DTypes are not specified and left ``None``, the behaviour may
+ depend on the ufunc.
+ At this time, a list of available signatures is provided by the **types**
+ attribute of the ufunc. (This list may be missing DTypes not defined
+ by NumPy.)
+
+ The ``signature`` only specifies the DType class/type. For example, it
+ can specifiy that the operation should be ``datetime64`` or ``float64``
+ operation. It does not specify the ``datetime64`` time-unit or the
+ ``float64`` byte-order.
+
+ For backwards compatibility this argument can also be provided as *sig*,
+ although the long form is preferred. Note that this should not be
+ confused with the generalized ufunc :ref:`signature <details-of-signature>`
+ that is stored in the **signature** attribute of the of the ufunc object.
*extobj*