Re: [Numpy-discussion] Shared memory check on in-place modification.

2015-07-27 Thread Sturla Molden
On 27/07/15 22:10, Anton Akhmerov wrote: > Hi everyone, > > I have encountered an initially rather confusing problem in a piece of > code that attempted to symmetrize a matrix: `h += h.T` > The problem of course appears due to `h.T` being a view of `h`, and > some elements being overwritten during

Re: [Numpy-discussion] Proposal: Deprecate np.int, np.float, etc.?

2015-07-27 Thread Sturla Molden
Chris Barker wrote: > 32 bits on all (most) 32 bit platforms > 64 bits on 64 bit Linux and OS-X > 32 bits on 64 bit Windows (also if compiled by cygwin??) sizeof(long) is 8 on 64-bit Cygwin. This is to make sure it is inconsistent with MSVC and MinGW-w64, and make sure there will always be ABI m

[Numpy-discussion] Shared memory check on in-place modification.

2015-07-27 Thread Anton Akhmerov
Hi everyone, I have encountered an initially rather confusing problem in a piece of code that attempted to symmetrize a matrix: `h += h.T` The problem of course appears due to `h.T` being a view of `h`, and some elements being overwritten during the __iadd__ call. What made it nasty is that it app

Re: [Numpy-discussion] Proposal: Deprecate np.int, np.float, etc.?

2015-07-27 Thread Chris Barker
On Sun, Jul 26, 2015 at 11:19 AM, Sturla Molden wrote: > > we get away with np.float, because every OS/compiler that gets any > regular > > use has np.float == a c double, which is always 64 bit. > > Not if we are passing an array of np.float to a ac routine that expects > float*, e.g. in OpenGL,

Re: [Numpy-discussion] Proposal: Deprecate np.int, np.float, etc.?

2015-07-27 Thread Sturla Molden
Chris Barker wrote: > we get away with np.float, because every OS/compiler that gets any regular > use has np.float == a c double, which is always 64 bit. Not if we are passing an array of np.float to a ac routine that expects float*, e.g. in OpenGL, BLAS or LAPACK. That will for sure give crazy

Re: [Numpy-discussion] constructing record dtypes from the c-api

2015-07-27 Thread Allan Haldane
Hi Jason, As I understand numpy has been set up to mirror C-structs as long as you use the 'align' flag. For example, your struct can be represented as >>> np.dtype('f8,f4,i4,u8', align=True) (assuming 32 bit floats). The offsets of the fields should be exactly the offsets of the elements

[Numpy-discussion] np.nonzero - order guarantees?

2015-07-27 Thread Matthew Brett
Hi, `np.nonzero` for a 2D array `A` returns: row_inds, col_inds = np.nonzero(A) I notice that `row_inds` appears to be sorted by value, and `col_inds` appears to be sorted by value, within each row. Is this a guarantee of the `np.nonzero` function? If not, does this function guarantee any prop