summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-01-10 11:36:50 -0800
committerCharles Harris <charlesr.harris@gmail.com>2014-01-10 11:36:50 -0800
commitd400b0422a016cf9ca75cc8e9375ea3c5324e88a (patch)
tree87fb69446f24699037400005baccce9b9b986806 /numpy/add_newdocs.py
parentd1dbf8e796ab6bcdc4f3b71252f3921ab2a62269 (diff)
parentb1b0ea8030cad32d6fce2e6e6b5068e54bd6b7a7 (diff)
downloadnumpy-d400b0422a016cf9ca75cc8e9375ea3c5324e88a.tar.gz
Merge pull request #4183 from charris/gh-4099
ENH: Remove unnecessary broadcasting notation restrictions in einsum.
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 62ca6dca3..62e8898c9 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -2078,6 +2078,8 @@ add_newdoc('numpy.core', 'einsum',
array([ 30, 80, 130, 180, 230])
>>> np.dot(a, b)
array([ 30, 80, 130, 180, 230])
+ >>> np.einsum('...j,j', a, b)
+ array([ 30, 80, 130, 180, 230])
>>> np.einsum('ji', c)
array([[0, 3],
@@ -2147,6 +2149,18 @@ add_newdoc('numpy.core', 'einsum',
[ 4796., 5162.],
[ 4928., 5306.]])
+ >>> a = np.arange(6).reshape((3,2))
+ >>> b = np.arange(12).reshape((4,3))
+ >>> np.einsum('ki,jk->ij', a, b)
+ array([[10, 28, 46, 64],
+ [13, 40, 67, 94]])
+ >>> np.einsum('ki,...k->i...', a, b)
+ array([[10, 28, 46, 64],
+ [13, 40, 67, 94]])
+ >>> np.einsum('k...,jk', a, b)
+ array([[10, 28, 46, 64],
+ [13, 40, 67, 94]])
+
""")
add_newdoc('numpy.core', 'alterdot',