From 6dec38800a4d39b0384720bfde0df089fee0886b Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Thu, 16 Feb 2006 03:15:55 +0000 Subject: Added axis= argument to cross --- numpy/core/numeric.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'numpy/core/numeric.py') 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"\ -- cgit v1.2.1