Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Pauli Virtanen
25.05.2012 13:46, Thouis (Ray) Jones kirjoitti: > I'm seeing some strange behavior from .max() on a reshaped array in > the current master, and wanted to raise it here to make sure it's not > something uniquely broken in my setup. > > This code fails for me, though changing the context (adding a c

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Nathaniel Smith
On Fri, May 25, 2012 at 4:59 PM, Robert Kern wrote: > On Fri, May 25, 2012 at 3:55 PM, Nathaniel Smith wrote: >> On May 25, 2012 2:21 PM, "Robert Kern" wrote: >>> >>> On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: >>> >>> > (Hmm, now that I think about it, the edge cases are when the strid

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Robert Kern
On Fri, May 25, 2012 at 3:55 PM, Nathaniel Smith wrote: > On May 25, 2012 2:21 PM, "Robert Kern" wrote: >> >> On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: >> >> > (Hmm, now that I think about it, the edge cases are when the strides >> > are 0 or negative. 0-stride axes can simply be remov

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Robert Kern
On Fri, May 25, 2012 at 3:55 PM, Nathaniel Smith wrote: > On May 25, 2012 2:21 PM, "Robert Kern" wrote: >> >> On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: >> >> > (Hmm, now that I think about it, the edge cases are when the strides >> > are 0 or negative. 0-stride axes can simply be remov

Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Thouis (Ray) Jones
On May 25, 2012 5:30 PM, "Thouis (Ray) Jones" wrote: > It happens at HEAD in Nathan's separate-maskna branch, as well. Sorry, Nathaniel's branch. My fingers went into autopilot. Ray ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://m

Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Thouis (Ray) Jones
I've bisected it down to this commit: https://github.com/numpy/numpy/commit/aed9925a9d5fe9a407d0ca2c65cb577116c4d0f1 This exercises it consistently for me: while True; do python -m nose.core ../numpy.bisect/numpy/lib/tests/test_function_base.py:TestHistogramdd --pdb --pdb-failures; done It happen

Re: [Numpy-discussion] indexes in an array where value is greater than 1?

2012-05-25 Thread Benjamin Root
On Fri, May 25, 2012 at 11:17 AM, Chris Withers wrote: > Hi All, > > I have an array: > > arrrgh = numpy.zeros(1) > > A sparse collection of elements will have values greater than zero: > > arrrgh[] = 2 > arrrgh[3453453] =42 > > The *wrong* way to do this is: > > for i in xrange(len(ar

[Numpy-discussion] indexes in an array where value is greater than 1?

2012-05-25 Thread Chris Withers
Hi All, I have an array: arrrgh = numpy.zeros(1) A sparse collection of elements will have values greater than zero: arrrgh[] = 2 arrrgh[3453453] =42 The *wrong* way to do this is: for i in xrange(len(arrrgh)): if arrrgh[i] > 1: print i What's the right way? Chris

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Nathaniel Smith
On May 25, 2012 2:21 PM, "Robert Kern" wrote: > > On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: > > > (Hmm, now that I think about it, the edge cases are when the strides > > are 0 or negative. 0-stride axes can simply be removed, and I think we > > should be able to work back to a first it

[Numpy-discussion] Retrieving and flattening lower triangular components of inner axes of 3d array

2012-05-25 Thread Damien Moore
Hi List, I have an array, x, with dimensions (K,M,M). I would like to compute a new array, y ~ (K,M*(M+1)/2), such that y[k] = numpy.tril(x[k]).flatten() for each k = 0,..,K-1 Is there a way to do this without looping? I was trying with tril_indices but couldn't quite get the logic right. Thank

Re: [Numpy-discussion] Checking for views

2012-05-25 Thread Dag Sverre Seljebotn
On 05/25/2012 03:17 PM, Robert Kern wrote: > On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: > >> (Hmm, now that I think about it, the edge cases are when the strides >> are 0 or negative. 0-stride axes can simply be removed, and I think we >> should be able to work back to a first item and fl

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Robert Kern
On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: > (Hmm, now that I think about it, the edge cases are when the strides > are 0 or negative. 0-stride axes can simply be removed, and I think we > should be able to work back to a first item and flip the sign on the > negative strides. The typica

Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Thouis Jones
On Fri, May 25, 2012 at 2:07 PM, Thouis Jones wrote: > I don't seem to be able to reproduce with just a.max(0) or > np.array(a.max(0), np.float), but since it seems to be very unstable > to other changes in the code, I'll keep trying to find out if I can > make those simpler versions crash. By th

Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Thouis Jones
On Fri, May 25, 2012 at 1:52 PM, Nathaniel Smith wrote: > On Fri, May 25, 2012 at 12:46 PM, Thouis (Ray) Jones wrote: >> I'm seeing some strange behavior from .max() on a reshaped array in >> the current master, and wanted to raise it here to make sure it's not >> something uniquely broken in my

Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Nathaniel Smith
On Fri, May 25, 2012 at 12:46 PM, Thouis (Ray) Jones wrote: > I'm seeing some strange behavior from .max() on a reshaped array in > the current master, and wanted to raise it here to make sure it's not > something uniquely broken in my setup. > > This code fails for me, though changing the context

[Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Thouis (Ray) Jones
I'm seeing some strange behavior from .max() on a reshaped array in the current master, and wanted to raise it here to make sure it's not something uniquely broken in my setup. This code fails for me, though changing the context (adding a counter to the loop, or running under "python -i") sometime