diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-02-16 03:15:55 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-02-16 03:15:55 +0000 |
commit | 6dec38800a4d39b0384720bfde0df089fee0886b (patch) | |
tree | 494290905414ced0e146f9a50740e26682956f09 /numpy/core/numeric.py | |
parent | 34535b95a1367750cdb4fa53a5a984f07391d97c (diff) | |
download | numpy-6dec38800a4d39b0384720bfde0df089fee0886b.tar.gz |
Added axis= argument to cross
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 103239a2f..cc1b0b1de 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -167,7 +167,7 @@ def _move_axis_to_0(a, axis): axes = range(1, axis+1) + [0,] + range(axis+1, n) return a.transpose(axes) -def cross(a, b, axisa=-1, axisb=-1, axisc=-1): +def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None): """Return the cross product of two (arrays of) vectors. The cross product is performed over the last axis of a and b by default, @@ -175,6 +175,8 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1): the z-component of the equivalent three-dimensional cross product is returned. """ + if axis is not None: + axisa,axisb,axisc=(axis,)*3 a = _move_axis_to_0(asarray(a), axisa) b = _move_axis_to_0(asarray(b), axisb) msg = "incompatible dimensions for cross product\n"\ |