summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-10-13 18:18:18 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-10-13 18:18:18 +0000
commit4f83a34fe0961bf00e27313949676c4101c44b73 (patch)
treef1b40f9170ab14cfcd13c9b01c26550806fd2a34 /numpy/core/numeric.py
parent45f9558ec55e04a214b1e259fb0a73ed08c1bd9f (diff)
downloadnumpy-4f83a34fe0961bf00e27313949676c4101c44b73.tar.gz
Fix-up tensor solve and tensor inv and rename to match tensordot.
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index ee17e1886..541a54739 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -252,7 +252,7 @@ except ImportError:
pass
-def tensordot(a, b, axes=[-1,0]):
+def tensordot(a, b, axes=2):
"""tensordot returns the product for any (ndim >= 1) arrays.
r_{xxx, yyy} = \sum_k a_{xxx,k} b_{k,yyy} where
@@ -265,9 +265,18 @@ def tensordot(a, b, axes=[-1,0]):
When there is more than one axis to sum over, the corresponding
arguments to axes should be sequences of the same length with the first
axis to sum over given first in both sequences, the second axis second,
- and so forth.
+ and so forth.
+
+ If the axes argument is an integer, N, then the last N dimensions of a
+ and first N dimensions of b are summed over.
"""
- axes_a, axes_b = axes
+ try:
+ iter(axes)
+ except:
+ axes_a = range(-axes,0)
+ axes_b = range(0,axes)
+ else:
+ axes_a, axes_b = axes
try:
na = len(axes_a)
axes_a = list(axes_a)