[Numpy-discussion] advanced indexing question

2015-02-03 Thread David Kershaw
The numpy reference manual, array objects/indexing/advance indexing, says: Advanced indexing always returns a copy of the data (contrast with basic slicing that returns a view). If I run the following code: import numpy as np d=range[2] x=np.arange(36).reshape(3,2,3,2) y=x[:,d,:,d] y+=1 p

Re: [Numpy-discussion] Any interest in a 'heaviside' ufunc?

2015-02-03 Thread josef.pktd
On Wed, Feb 4, 2015 at 12:18 AM, Warren Weckesser < warren.weckes...@gmail.com> wrote: > > > On Tue, Feb 3, 2015 at 11:14 PM, Sturla Molden > wrote: > >> Warren Weckesser wrote: >> >> > 0if x < 0 >> > heaviside(x) = 0.5 if x == 0 >> > 1if x >

Re: [Numpy-discussion] Any interest in a 'heaviside' ufunc?

2015-02-03 Thread Jaime Fernández del Río
On Tue, Feb 3, 2015 at 12:58 PM, Warren Weckesser < warren.weckes...@gmail.com> wrote: > I have an implementation of the Heaviside function as numpy ufunc. Is > there any interest in adding this to numpy? The function is simply: > > 0if x < 0 > heaviside(x) = 0.5 if

Re: [Numpy-discussion] Any interest in a 'heaviside' ufunc?

2015-02-03 Thread Warren Weckesser
On Tue, Feb 3, 2015 at 11:14 PM, Sturla Molden wrote: > Warren Weckesser wrote: > > > 0if x < 0 > > heaviside(x) = 0.5 if x == 0 > > 1if x > 0 > > > > This is not correct. The discrete form of the Heaviside step function has > the value 1 for

Re: [Numpy-discussion] Any interest in a 'heaviside' ufunc?

2015-02-03 Thread Aron Ahmadia
> This is not correct. The discrete form of the Heaviside step function has > the value 1 for x == 0. > Yeah, I was looking at it and wondering if I'd misremembered the definition. Assuming you're implementing the discrete Heaviside function, H[0] = 1 as Sturla notes. ___

Re: [Numpy-discussion] Any interest in a 'heaviside' ufunc?

2015-02-03 Thread Sturla Molden
Warren Weckesser wrote: > 0if x < 0 > heaviside(x) = 0.5 if x == 0 > 1if x > 0 > This is not correct. The discrete form of the Heaviside step function has the value 1 for x == 0. heaviside = lambda x : 1 - (x < 0).astype(int) Sturla ___

Re: [Numpy-discussion] Views of a different dtype

2015-02-03 Thread Ian Henriksen
On Tue Feb 03 2015 at 1:47:34 PM Jaime Fernández del Río < jaime.f...@gmail.com> wrote: > On Tue, Feb 3, 2015 at 8:59 AM, Sebastian Berg > wrote: > >> On Di, 2015-02-03 at 07:18 -0800, Jaime Fernández del Río wrote: >> > >> >> > >> > >> > >> > Do you have a concrete example of what a non (1, 1)

Re: [Numpy-discussion] Any interest in a 'heaviside' ufunc?

2015-02-03 Thread Aron Ahmadia
That seems useful to me. On Tue, Feb 3, 2015 at 3:58 PM, Warren Weckesser wrote: > I have an implementation of the Heaviside function as numpy ufunc. Is > there any interest in adding this to numpy? The function is simply: > > 0if x < 0 > heaviside(x) = 0.5 if x =

[Numpy-discussion] Any interest in a 'heaviside' ufunc?

2015-02-03 Thread Warren Weckesser
I have an implementation of the Heaviside function as numpy ufunc. Is there any interest in adding this to numpy? The function is simply: 0if x < 0 heaviside(x) = 0.5 if x == 0 1if x > 0 Warren __

Re: [Numpy-discussion] Views of a different dtype

2015-02-03 Thread Jaime Fernández del Río
On Tue, Feb 3, 2015 at 8:59 AM, Sebastian Berg wrote: > On Di, 2015-02-03 at 07:18 -0800, Jaime Fernández del Río wrote: > > > > > > > > > > > Do you have a concrete example of what a non (1, 1) array that fails > > with relaxed strides would look like? > > > > > > If we used, as right now, the

[Numpy-discussion] F2PY and multi-dimension arrays - unexpected array size error

2015-02-03 Thread Backing Olof
Hi I am helping out with a Python and Fortran project. Let me give you some background: * Fortran source: C Bergstrom FCC C User subroutine VUMAT subroutine VUMAT( C Read only - * nblock, ndir, nshr, nstatev, nprops, * stepTime, dt, * props, * density, st

Re: [Numpy-discussion] Views of a different dtype

2015-02-03 Thread Sebastian Berg
On Di, 2015-02-03 at 07:18 -0800, Jaime Fernández del Río wrote: > > > > > Do you have a concrete example of what a non (1, 1) array that fails > with relaxed strides would look like? > > > If we used, as right now, the array flags as a first choice point, and > only if none is set t

Re: [Numpy-discussion] Views of a different dtype

2015-02-03 Thread Jaime Fernández del Río
On Tue, Feb 3, 2015 at 1:28 AM, Sebastian Berg wrote: > On Mo, 2015-02-02 at 06:25 -0800, Jaime Fernández del Río wrote: > > On Sat, Jan 31, 2015 at 1:17 AM, Sebastian Berg > > wrote: > > On Fr, 2015-01-30 at 19:52 -0800, Jaime Fernández del Río > > wrote: > > > On Thu, J

Re: [Numpy-discussion] Views of a different dtype

2015-02-03 Thread Sebastian Berg
On Mo, 2015-02-02 at 06:25 -0800, Jaime Fernández del Río wrote: > On Sat, Jan 31, 2015 at 1:17 AM, Sebastian Berg > wrote: > On Fr, 2015-01-30 at 19:52 -0800, Jaime Fernández del Río > wrote: > > On Thu, Jan 29, 2015 at 8:57 AM, Nathaniel Smith > > > wrote