diff options
Diffstat (limited to 'doc/source/reference')
-rw-r--r-- | doc/source/reference/c-api.array.rst | 14 | ||||
-rw-r--r-- | doc/source/reference/internals.code-explanations.rst | 8 | ||||
-rw-r--r-- | doc/source/reference/ufuncs.rst | 22 |
3 files changed, 22 insertions, 22 deletions
diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst index bbd247f6b..87acb2684 100644 --- a/doc/source/reference/c-api.array.rst +++ b/doc/source/reference/c-api.array.rst @@ -205,7 +205,7 @@ From scratch If *subtype* is of an array subclass instead of the base :c:data:`&PyArray_Type<PyArray_Type>`, then *obj* is the object to pass to - the :obj:`__array_finalize__` method of the subclass. + the :obj:`~numpy.class.__array_finalize__` method of the subclass. If *data* is ``NULL``, then new memory will be allocated and *flags* can be non-zero to indicate a Fortran-style contiguous array. If @@ -378,7 +378,7 @@ From other objects expose the array interface), then a new array will be created (and filled from *op* using the sequence protocol). The new array will have :c:data:`NPY_DEFAULT` as its flags member. The *context* argument - is passed to the :obj:`__array__` method of *op* and is only used if + is passed to the :obj:`~numpy.class.__array__` method of *op* and is only used if the array is constructed that way. Almost always this parameter is ``NULL``. @@ -499,7 +499,7 @@ From other objects actually converting to an array. PyArray_FromAny calls this function to analyze its input. - In some cases, such as structured arrays and the __array__ interface, + In some cases, such as structured arrays and the :obj:`~numpy.class.__array__` interface, a data type needs to be used to make sense of the object. When this is needed, provide a Descr for 'requested_dtype', otherwise provide NULL. This reference is not stolen. Also, if the requested @@ -607,9 +607,9 @@ From other objects .. c:function:: PyObject* PyArray_FromArrayAttr(PyObject* op, PyArray_Descr* dtype, PyObject* context) Return an ndarray object from a Python object that exposes the - :obj:`__array__` method. The :obj:`__array__` method can take 0, 1, or 2 + :obj:`~numpy.class.__array__` method. The :obj:`~numpy.class.__array__` method can take 0, 1, or 2 arguments ([dtype, context]) where *context* is used to pass - information about where the :obj:`__array__` method is being called + information about where the :obj:`~numpy.class.__array__` method is being called from (currently only used in ufuncs). .. c:function:: PyObject* PyArray_ContiguousFromAny(PyObject* op, int typenum, int min_depth, int max_depth) @@ -787,7 +787,7 @@ General check of Python Type conversion occurs. Otherwise, out will contain a borrowed reference to Py_NotImplemented and no error condition is set. This version allows setting of the type and context in the part of - the array interface that looks for the :obj:`__array__` attribute. + the array interface that looks for the :obj:`~numpy.class.__array__` attribute. .. c:function:: PyArray_IsZeroDim(op) @@ -3188,7 +3188,7 @@ Priority .. c:function:: double PyArray_GetPriority(PyObject* obj, double def) - Return the :obj:`__array_priority__` attribute (converted to a + Return the :obj:`~numpy.class.__array_priority__` attribute (converted to a double) of *obj* or *def* if no attribute of that name exists. Fast returns that avoid the attribute lookup are provided for objects of type :c:data:`PyArray_Type`. diff --git a/doc/source/reference/internals.code-explanations.rst b/doc/source/reference/internals.code-explanations.rst index fca87f260..af34d716f 100644 --- a/doc/source/reference/internals.code-explanations.rst +++ b/doc/source/reference/internals.code-explanations.rst @@ -460,12 +460,12 @@ Ufuncs allow other array-like classes to be passed seamlessly through the interface in that inputs of a particular class will induce the outputs to be of that same class. The mechanism by which this works is the following. If any of the inputs are not ndarrays and define the -:obj:`__array_wrap__` method, then the class with the largest -:obj:`__array_priority__` attribute determines the type of all the +:obj:`~numpy.class.__array_wrap__` method, then the class with the largest +:obj:`~numpy.class.__array_priority__` attribute determines the type of all the outputs (with the exception of any output arrays passed in). The -:obj:`__array_wrap__` method of the input array will be called with the +:obj:`~numpy.class.__array_wrap__` method of the input array will be called with the ndarray being returned from the ufunc as it's input. There are two -calling styles of the :obj:`__array_wrap__` function supported. The first +calling styles of the :obj:`~numpy.class.__array_wrap__` function supported. The first takes the ndarray as the first argument and a tuple of "context" as the second argument. The context is (ufunc, arguments, output argument number). This is the first call tried. If a TypeError occurs, then the diff --git a/doc/source/reference/ufuncs.rst b/doc/source/reference/ufuncs.rst index 82a47c724..4dd1b3e18 100644 --- a/doc/source/reference/ufuncs.rst +++ b/doc/source/reference/ufuncs.rst @@ -103,24 +103,24 @@ Output type determination The output of the ufunc (and its methods) is not necessarily an :class:`ndarray`, if all input arguments are not :class:`ndarrays <ndarray>`. -All output arrays will be passed to the :obj:`__array_prepare__` and -:obj:`__array_wrap__` methods of the input (besides +All output arrays will be passed to the :obj:`~class.__array_prepare__` and +:obj:`~class.__array_wrap__` methods of the input (besides :class:`ndarrays <ndarray>`, and scalars) that defines it **and** has -the highest :obj:`__array_priority__` of any other input to the -universal function. The default :obj:`__array_priority__` of the -ndarray is 0.0, and the default :obj:`__array_priority__` of a subtype -is 1.0. Matrices have :obj:`__array_priority__` equal to 10.0. +the highest :obj:`~class.__array_priority__` of any other input to the +universal function. The default :obj:`~class.__array_priority__` of the +ndarray is 0.0, and the default :obj:`~class.__array_priority__` of a subtype +is 1.0. Matrices have :obj:`~class.__array_priority__` equal to 10.0. All ufuncs can also take output arguments. If necessary, output will be cast to the data-type(s) of the provided output array(s). If a class -with an :obj:`__array__` method is used for the output, results will be -written to the object returned by :obj:`__array__`. Then, if the class -also has an :obj:`__array_prepare__` method, it is called so metadata +with an :obj:`~class.__array__` method is used for the output, results will be +written to the object returned by :obj:`~class.__array__`. Then, if the class +also has an :obj:`~class.__array_prepare__` method, it is called so metadata may be determined based on the context of the ufunc (the context consisting of the ufunc itself, the arguments passed to the ufunc, and the ufunc domain.) The array object returned by -:obj:`__array_prepare__` is passed to the ufunc for computation. -Finally, if the class also has an :obj:`__array_wrap__` method, the returned +:obj:`~class.__array_prepare__` is passed to the ufunc for computation. +Finally, if the class also has an :obj:`~class.__array_wrap__` method, the returned :class:`ndarray` result will be passed to that method just before passing control back to the caller. |