On Thu, Jun 21, 2012 at 12:11 AM, Matthew Brett wrote:
> Hi,
>
> On Wed, Jun 20, 2012 at 10:43 PM, Charles R Harris
> wrote:
> >
> >
> > On Wed, Jun 20, 2012 at 4:11 PM, Matthew Brett
> > wrote:
> >>
> >> Hi,
> >>
> >> On Wed, Jun 20, 2012 at 3:05 PM, Charles R Harris
> >> wrote:
> >> >
> >> >
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]: nphas(b
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 c
On Wed, Jun 20, 2012 at 8:58 AM, Neal Becker 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 mailing list
Nu
On Wed, Jun 20, 2012 at 3:58 PM, Neal Becker 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
_
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
http://mail.scipy.org/mail