Python "max" and "min" have an interesting and _useful_ behavior when
applied to numpy scalars and Python numbers. Here is a piece of
pseudo-code:
def max(a, b):
if int(b) > int(a):
return b
else:
return a
The larger object is returned unchanged. If the two objects a
Just submitted this pull request for discussion:
https://github.com/numpy/numpy/pull/297
As per earlier discussion on the list, this PR attempts to remove
exactly and only the maskna-related code from numpy mainline:
http://mail.scipy.org/pipermail/numpy-discussion/2012-May/062417.html
The su
On 06/06/2012 06:35 PM, Robert Kern wrote:
> On Wed, Jun 6, 2012 at 4:52 PM, Robert Cimrman wrote:
>
>> Yes (in that thread), but it applies also adding/assembling vectors into a
>> global vector - this is just x[idx] += vals. I linked that discussion as that
>> was recent enough for me to recall
That does seem like it should work well if len(unique(idx)) is close to
len(x). Thanks!
On Wed, Jun 6, 2012 at 9:35 AM, Robert Kern wrote:
> On Wed, Jun 6, 2012 at 4:52 PM, Robert Cimrman
> wrote:
>
> > Yes (in that thread), but it applies also adding/assembling vectors into
> a
> > global vect
On Wed, Jun 6, 2012 at 4:52 PM, Robert Cimrman wrote:
> Yes (in that thread), but it applies also adding/assembling vectors into a
> global vector - this is just x[idx] += vals. I linked that discussion as that
> was recent enough for me to recall it, but there were other.
>
> Anyway, my point wa
On 06/06/2012 05:34 PM, Nathaniel Smith wrote:
> On Wed, Jun 6, 2012 at 4:30 PM, Robert Cimrman wrote:
>> On 06/06/2012 05:06 PM, Nathaniel Smith wrote:
>>> On Wed, Jun 6, 2012 at 9:48 AM, John Salvatier
>>> wrote:
Hello,
I've noticed that If you try to increment elements of an
On Wed, Jun 6, 2012 at 4:30 PM, Robert Cimrman wrote:
> On 06/06/2012 05:06 PM, Nathaniel Smith wrote:
>> On Wed, Jun 6, 2012 at 9:48 AM, John Salvatier
>> wrote:
>>> Hello,
>>>
>>> I've noticed that If you try to increment elements of an array with advanced
>>> indexing, repeated indexes don't
On 06/06/2012 05:06 PM, Nathaniel Smith wrote:
> On Wed, Jun 6, 2012 at 9:48 AM, John Salvatier
> wrote:
>> Hello,
>>
>> I've noticed that If you try to increment elements of an array with advanced
>> indexing, repeated indexes don't get repeatedly incremented. For example:
>>
>> In [30]: x = zer
On Wed, Jun 6, 2012 at 9:48 AM, John Salvatier
wrote:
> Hello,
>
> I've noticed that If you try to increment elements of an array with advanced
> indexing, repeated indexes don't get repeatedly incremented. For example:
>
> In [30]: x = zeros(5)
>
> In [31]: idx = array([1,1,1,3,4])
>
> In [32]: x
Thank you for the suggestion, but it looks like that has the same behavior
too:
In [43]: x = zeros(5)
In [44]: idx = array([1,1,1,3,4])
In [45]: put(x,idx, [2,4,8,10,30])
In [46]: x
Out[46]: array([ 0., 8., 0., 10., 30.])
On Wed, Jun 6, 2012 at 6:07 AM, Frédéric Bastien wrote:
> Hi,
Not sure if this is a bug or not. I am using a fairly recent master branch.
>>> # Setting up...
>>> import numpy as np
>>> a = np.zeros((10, 1), dtype=[('foo', 'f4'), ('bar', 'f4'), ('spam',
'f4')])
>>> a['foo'] = np.random.random((10, 1))
>>> a['bar'] = np.random.random((10, 1))
>>> a['spam'] =
Hi,
I get across the numpy.put[1] function. I'm not sure, but maybe it do
what you want. My memory are fuzy about this and they don't tell about
this in the doc of this function.
Fred
[1] http://docs.scipy.org/doc/numpy/reference/generated/numpy.put.html
On Wed, Jun 6, 2012 at 4:48 AM, John Sa
On 06/06/2012 12:06 AM, mark florisson wrote:
> On 5 June 2012 22:36, Dag Sverre Seljebotn wrote:
>> On 06/05/2012 10:47 PM, mark florisson wrote:
>>> On 5 June 2012 20:17, Nathaniel Smithwrote:
On Tue, Jun 5, 2012 at 7:08 PM, mark florisson
wrote:
> On 5 June 2012 17:38, Nat
Hello,
I've noticed that If you try to increment elements of an array with
advanced indexing, repeated indexes don't get repeatedly incremented. For
example:
In [30]: x = zeros(5)
In [31]: idx = array([1,1,1,3,4])
In [32]: x[idx] += [2,4,8,10,30]
In [33]: x
Out[33]: array([ 0., 8., 0., 1
14 matches
Mail list logo