summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Taylor <juliantaylor108@gmail.com>2014-12-10 20:20:24 +0100
committerJulian Taylor <juliantaylor108@gmail.com>2014-12-10 20:20:24 +0100
commitcf2dc930e7b7f737445e8698041b5d98f6f88c4e (patch)
treecb60a75c8965a71ea4b4e487e1f73eb590a02183
parentc5808d11299d6866886dd5fc89d8d522dc06617d (diff)
parent5ef95667c2feacc6d7f3206ad19fd222ecd2d7c1 (diff)
downloadnumpy-cf2dc930e7b7f737445e8698041b5d98f6f88c4e.tar.gz
Merge pull request #5277 from sotte/multidot_typos
DOC: fix typos and clarify multi_dot docstring..
-rw-r--r--numpy/linalg/linalg.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index 43b2dc4dc..383c51387 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -2162,12 +2162,13 @@ def multi_dot(arrays):
Compute the dot product of two or more arrays in a single function call,
while automatically selecting the fastest evaluation order.
- `multi_dot` chains `numpy.dot` and uses an optimal parenthesizations
- of the matrices [1]_ [2]_. Depending on the shape of the matrices
+ `multi_dot` chains `numpy.dot` and uses optimal parenthesization
+ of the matrices [1]_ [2]_. Depending on the shapes of the matrices,
this can speed up the multiplication a lot.
- The first and last argument can be 1-D and are treated respectively as
- row and column vector. The other arguments must be 2-D.
+ If the first argument is 1-D it is treated as a row vector.
+ If the last argument is 1-D it is treated as a column vector.
+ The other arguments must be 2-D.
Think of `multi_dot` as::
@@ -2177,8 +2178,9 @@ def multi_dot(arrays):
Parameters
----------
arrays : sequence of array_like
- First and last argument can be 1-D and are treated respectively as
- row and column vector, the other arguments must be 2-D.
+ If the first argument is 1-D it is treated as row vector.
+ If the last argument is 1-D it is treated as column vector.
+ The other arguments must be 2-D.
Returns
-------
@@ -2199,7 +2201,7 @@ def multi_dot(arrays):
--------
`multi_dot` allows you to write::
- >>> import numpy as np
+ >>> from numpy.linalg import multi_dot
>>> # Prepare some data
>>> A = np.random.random(10000, 100)
>>> B = np.random.random(100, 1000)
@@ -2269,10 +2271,10 @@ def multi_dot(arrays):
def _multi_dot_three(A, B, C):
"""
- Find best ordering for three arrays and do the multiplication.
+ Find the best order for three arrays and do the multiplication.
- Doing in manually instead of using dynamic programing is
- approximately 15 times faster.
+ For three arguments `_multi_dot_three` is approximately 15 times faster
+ than `_multi_dot_matrix_chain_order`
"""
# cost1 = cost((AB)C)
@@ -2290,7 +2292,7 @@ def _multi_dot_three(A, B, C):
def _multi_dot_matrix_chain_order(arrays, return_costs=False):
"""
- Return a np.array which encodes the opimal order of mutiplications.
+ Return a np.array that encodes the optimal order of mutiplications.
The optimal order array is then used by `_multi_dot()` to do the
multiplication.