diff options
author | Jarrod Millman <millman@berkeley.edu> | 2008-11-16 09:14:01 +0000 |
---|---|---|
committer | Jarrod Millman <millman@berkeley.edu> | 2008-11-16 09:14:01 +0000 |
commit | 2201bb33c6d46cad1817e8746ecc5a6285891a1d (patch) | |
tree | 7bd4a5eb426e552cebb2efc601219c51d4539772 /doc | |
parent | d0d9ce4349ef95a85fdc81d2d58ef7967b2c1f41 (diff) | |
download | numpy-2201bb33c6d46cad1817e8746ecc5a6285891a1d.tar.gz |
removing some quotes
Diffstat (limited to 'doc')
-rw-r--r-- | doc/neps/generalized-ufuncs.rst | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/doc/neps/generalized-ufuncs.rst b/doc/neps/generalized-ufuncs.rst index 3d32e7c79..7d65118a5 100644 --- a/doc/neps/generalized-ufuncs.rst +++ b/doc/neps/generalized-ufuncs.rst @@ -18,18 +18,18 @@ what the "core" dimensionality of the inputs is, as well as the corresponding dimensionality of the outputs (the element-wise ufuncs have zero core dimensions). The list of the core dimensions for all arguments is called the "signature" of a ufunc. For example, the -ufunc numpy.add has signature ``"(),()->()"`` defining two scalar inputs +ufunc numpy.add has signature ``(),()->()`` defining two scalar inputs and one scalar output. Another example is (see the GeneralLoopingFunctions page) the function -``inner1d(a,b)`` with a signature of ``"(i),(i)->()"``. This applies the +``inner1d(a,b)`` with a signature of ``(i),(i)->()``. This applies the inner product along the last axis of each input, but keeps the remaining indices intact. For example, where ``a`` is of shape ``(3,5,N)`` and ``b`` is of shape ``(5,N)``, this will return an output of shape ``(3,5)``. The underlying elementary function is called 3*5 times. In the -signature, we specify one core dimension ``"(i)"`` for each input and zero core -dimensions ``"()"`` for the output, since it takes two 1-d arrays and -returns a scalar. By using the same name ``"i"``, we specify that the two +signature, we specify one core dimension ``(i)`` for each input and zero core +dimensions ``()`` for the output, since it takes two 1-d arrays and +returns a scalar. By using the same name ``i``, we specify that the two corresponding dimensions should be of the same size (or one of them is of size 1 and will be broadcasted). @@ -91,11 +91,11 @@ dimensions. The signature is represented by a string of the following format: * Core dimensions of each input or output array are represented by a - list of dimension names in parentheses, ``"(i_1,...,i_N)"``; a scalar - input/output is denoted by ``"()"``. Instead of ``"i_1"``, ``"i_2"``, + list of dimension names in parentheses, ``(i_1,...,i_N)``; a scalar + input/output is denoted by ``()``. Instead of ``i_1``, ``i_2``, etc, one can use any valid Python variable name. -* Dimension lists for different arguments are separated by ``","``. - Input/output arguments are separated by ``"->"``. +* Dimension lists for different arguments are separated by ``*,*``. + Input/output arguments are separated by ``->``. * If one uses the same dimension name in multiple locations, this enforces the same size (or broadcastable size) of the corresponding dimensions. @@ -123,19 +123,19 @@ Notes: Here are some examples of signatures: -+-------------+--------------------------+-----------------------------------+ -| add | ``"(),()->()"`` | | -+-------------+--------------------------+-----------------------------------+ -| inner1d | ``"(i),(i)->()"`` | | -+-------------+--------------------------+-----------------------------------+ -| sum1d | ``"(i)->()"`` | | -+-------------+--------------------------+-----------------------------------+ -| dot2d | ``"(m,n),(n,p)->(m,p)"`` | matrix multiplication | -+-------------+--------------------------+-----------------------------------+ -| outer_inner | ``"(i,t),(j,t)->(i,j)"`` | inner over the last dimension, | -| | | outer over the second to last, | -| | | and loop/broadcast over the rest. | -+-------------+--------------------------+-----------------------------------+ ++-------------+------------------------+-----------------------------------+ +| add | ``(),()->()`` | | ++-------------+------------------------+-----------------------------------+ +| inner1d | ``(i),(i)->()`` | | ++-------------+------------------------+-----------------------------------+ +| sum1d | ``(i)->()`` | | ++-------------+------------------------+-----------------------------------+ +| dot2d | ``(m,n),(n,p)->(m,p)`` | matrix multiplication | ++-------------+------------------------+-----------------------------------+ +| outer_inner | ``(i,t),(j,t)->(i,j)`` | inner over the last dimension, | +| | | outer over the second to last, | +| | | and loop/broadcast over the rest. | ++-------------+------------------------+-----------------------------------+ C-API for implementing Elementary Functions ------------------------------------------- @@ -167,7 +167,7 @@ The first ``nargs`` elements of ``steps`` remain the same as for scalar ufuncs. The following elements contain the strides of all core dimensions for all arguments in order. -For example, consider a ufunc with signature ``"(i,j),(i)->()"``. In +For example, consider a ufunc with signature ``(i,j),(i)->()``. In this case, ``args`` will contain three pointers to the data of the input/output arrays ``a``, ``b``, ``c``. Furthermore, ``dimensions`` will be ``[N, I, J]`` to define the size of ``N`` of the loop and the sizes ``I`` and ``J`` |