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
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
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
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
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]: