[Numpy-discussion] Re: Dot product threading?

Robert Kern robert.kern at gmail.com
Sat May 13 20:49:03 EDT 2006


Angus McMorland wrote:
> Is there a way to specify which dimensions I want dot to work over?

Use swapaxes() on the arrays to put the desired axes in the right places.

In [2]: numpy.swapaxes?
Type:           function
Base Class:     <type 'function'>
String Form:    <function swapaxes at 0x5d6d30>
Namespace:      Interactive
File:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy-0.9.7.2476-py2.4-macosx-10.4-ppc.egg/numpy/core/oldnumeric.py
Definition:     numpy.swapaxes(a, axis1, axis2)
Docstring:
    swapaxes(a, axis1, axis2) returns array a with axis1 and axis2
    interchanged.


In [3]: numpy.dot?
Type:           builtin_function_or_method
Base Class:     <type 'builtin_function_or_method'>
String Form:    <built-in function dot>
Namespace:      Interactive
Docstring:
    matrixproduct(a,b)
    Returns the dot product of a and b for arrays of floating point types.
    Like the generic numpy equivalent the product sum is over
    the last dimension of a and the second-to-last dimension of b.
    NB: The first argument is not conjugated.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco





More information about the NumPy-Discussion mailing list