diff options
author | Michael Seifert <michaelseifert04@yahoo.de> | 2017-03-27 00:51:45 +0200 |
---|---|---|
committer | Michael Seifert <michaelseifert04@yahoo.de> | 2017-03-27 00:51:54 +0200 |
commit | 74a93eca222c576d99a1d301fb102131cb1d47cb (patch) | |
tree | d4ce7d681bfc081856dc8bdebfcc1cad4541a31d | |
parent | 0e2c648d93cdfe659a073b9f03ca7036917d5b7f (diff) | |
download | numpy-74a93eca222c576d99a1d301fb102131cb1d47cb.tar.gz |
DOC: Corrected links for several __array_*__ functions
-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 | ||||
-rw-r--r-- | doc/source/user/c-info.beyond-basics.rst | 18 | ||||
-rw-r--r-- | doc/source/user/c-info.how-to-extend.rst | 2 |
5 files changed, 32 insertions, 32 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. diff --git a/doc/source/user/c-info.beyond-basics.rst b/doc/source/user/c-info.beyond-basics.rst index a75c05b64..f717b087e 100644 --- a/doc/source/user/c-info.beyond-basics.rst +++ b/doc/source/user/c-info.beyond-basics.rst @@ -500,13 +500,13 @@ The __array_finalize\__ method sub-type is created in such a fashion, however, neither the __new_\_ method nor the __init\__ method gets called. Instead, the sub-type is allocated and the appropriate instance-structure - members are filled in. Finally, the :obj:`__array_finalize__` + members are filled in. Finally, the :obj:`~numpy.class.__array_finalize__` attribute is looked-up in the object dictionary. If it is present and not None, then it can be either a CObject containing a pointer to a :c:func:`PyArray_FinalizeFunc` or it can be a method taking a single argument (which could be None). - If the :obj:`__array_finalize__` attribute is a CObject, then the pointer + If the :obj:`~numpy.class.__array_finalize__` attribute is a CObject, then the pointer must be a pointer to a function with the signature: .. code-block:: c @@ -519,7 +519,7 @@ The __array_finalize\__ method is present). This routine can do anything it wants to. It should return a -1 on error and 0 otherwise. - If the :obj:`__array_finalize__` attribute is not None nor a CObject, + If the :obj:`~numpy.class.__array_finalize__` attribute is not None nor a CObject, then it must be a Python method that takes the parent array as an argument (which could be None if there is no parent), and returns nothing. Errors in this method will be caught and handled. @@ -533,14 +533,14 @@ The __array_priority\__ attribute This attribute allows simple but flexible determination of which sub- type should be considered "primary" when an operation involving two or more sub-types arises. In operations where different sub-types are - being used, the sub-type with the largest :obj:`__array_priority__` + being used, the sub-type with the largest :obj:`~numpy.class.__array_priority__` attribute will determine the sub-type of the output(s). If two sub- - types have the same :obj:`__array_priority__` then the sub-type of the + types have the same :obj:`~numpy.class.__array_priority__` then the sub-type of the first argument determines the output. The default - :obj:`__array_priority__` attribute returns a value of 0.0 for the base + :obj:`~numpy.class.__array_priority__` attribute returns a value of 0.0 for the base ndarray type and 1.0 for a sub-type. This attribute can also be defined by objects that are not sub-types of the ndarray and can be - used to determine which :obj:`__array_wrap__` method should be called for + used to determine which :obj:`~numpy.class.__array_wrap__` method should be called for the return output. The __array_wrap\__ method @@ -550,11 +550,11 @@ The __array_wrap\__ method Any class or type can define this method which should take an ndarray argument and return an instance of the type. It can be seen as the - opposite of the :obj:`__array__` method. This method is used by the + opposite of the :obj:`~numpy.class.__array__` method. This method is used by the ufuncs (and other NumPy functions) to allow other objects to pass through. For Python >2.4, it can also be used to write a decorator that converts a function that works only with ndarrays to one that - works with any type with :obj:`__array__` and :obj:`__array_wrap__` methods. + works with any type with :obj:`~numpy.class.__array__` and :obj:`~numpy.class.__array_wrap__` methods. .. index:: pair: ndarray; subtyping diff --git a/doc/source/user/c-info.how-to-extend.rst b/doc/source/user/c-info.how-to-extend.rst index c5c3062a8..eeb01436d 100644 --- a/doc/source/user/c-info.how-to-extend.rst +++ b/doc/source/user/c-info.how-to-extend.rst @@ -381,7 +381,7 @@ writeable). The syntax is so that data does not have to be copied. Objects that can be converted to an array include: 1) any nested sequence object, 2) any object exposing the array interface, 3) any object with - an :obj:`__array__` method (which should return an ndarray), + an :obj:`~numpy.class.__array__` method (which should return an ndarray), and 4) any scalar object (becomes a zero-dimensional array). Sub-classes of the ndarray that otherwise fit the requirements will be passed through. If you want to ensure |