summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorLuis Pedro Coelho <lpc@cmu.edu>2010-11-12 10:52:19 -0500
committerPauli Virtanen <pav@iki.fi>2011-02-12 18:11:37 +0100
commitaf1e833e49dafc6d96b20de90a44633f11450b3f (patch)
tree6b2250f944add4f0872ae14d407dd81f4e02955a /numpy/add_newdocs.py
parentca9d4a73391630d3565ef04cbfaf3bf45e1c5474 (diff)
downloadnumpy-af1e833e49dafc6d96b20de90a44633f11450b3f.tar.gz
ENH: core: Allow user to pass in output array for dot()
This avoids the memory allocation. It is strict in checking that the types are correct, but since it is intended as an optimisation, it should only be used when the user knows what they are doing. The out parameter is added both to the BLAS and non-BLAS versions of dot(). Tests are included.
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 1a55b6bc7..5b65d9ce1 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -1447,7 +1447,7 @@ add_newdoc('numpy.core.multiarray', 'getbuffer',
add_newdoc('numpy.core', 'dot',
"""
- dot(a, b)
+ dot(a, b, out=None)
Dot product of two arrays.
@@ -1464,6 +1464,13 @@ add_newdoc('numpy.core', 'dot',
First argument.
b : array_like
Second argument.
+ out : ndarray, optional
+ Output argument. This must have the exact kind that would be returned
+ if it was not used. In particular, it must have the right type, must be
+ C-contiguous, and its dtype must be the dtype that would be returned
+ for `dot(a,b)`. This is a performance feature. Therefore, if these
+ conditions are not met, an exception is raised, instead of attempting
+ to be flexible.
Returns
-------
@@ -1471,6 +1478,7 @@ add_newdoc('numpy.core', 'dot',
Returns the dot product of `a` and `b`. If `a` and `b` are both
scalars or both 1-D arrays then a scalar is returned; otherwise
an array is returned.
+ If `out` is given, then it is returned.
Raises
------