[Numpy-discussion] trivial question?

2012-06-20 Thread Neal Becker
Maybe I'm being slow, but is there any convenient function to calculate, for 2 vectors: \sum_i \sum_j x_i y_j (I had a matrix once, but it vanished without a trace) ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] trivial question?

2012-06-20 Thread Robert Kern
On Wed, Jun 20, 2012 at 3:58 PM, Neal Becker ndbeck...@gmail.com wrote: Maybe I'm being slow, but is there any convenient function to calculate, for 2 vectors: \sum_i \sum_j x_i y_j (I had a matrix once, but it vanished without a trace) np.multiply.outer(x, y).sum() -- Robert Kern

Re: [Numpy-discussion] trivial question?

2012-06-20 Thread Charles R Harris
On Wed, Jun 20, 2012 at 8:58 AM, Neal Becker ndbeck...@gmail.com wrote: Maybe I'm being slow, but is there any convenient function to calculate, for 2 vectors: \sum_i \sum_j x_i y_j It factors, just do x.sum()*y.sum(). Chuck ___ NumPy-Discussion

[Numpy-discussion] PyArray_MapIter{Reset, Next, New, Bind} not exposed?

2012-06-20 Thread John Salvatier
Hello, I wanted to create a function that visits elements in an array using the same rules as advanced indexing (with integer and boolean arrays) but does addition instead of assignment (discussed more here http://mail.scipy.org/pipermail/numpy-discussion/2012-June/062687.html). I looked at the

[Numpy-discussion] frompyfunc question

2012-06-20 Thread Larsen, Brian A
Hello all, I was looking to wrap hasattr in a numpy ufunc and got some weird behavior. Here is a transcript: In [5]: import numpy as np In [6]: np.__version__ Out[6]: '1.6.2' In [7]: b = [1,2,3] In [7]: nphas = np.frompyfunc(hasattr, 2, 1) In [8]: hasattr(b, 'extend') Out[8]: True In [9]: