Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Benjamin Root
On Saturday, November 17, 2012, Charles R Harris wrote: > > > On Sat, Nov 17, 2012 at 1:00 PM, Olivier Delalleau > > > wrote: > >> 2012/11/17 Gökhan Sever > 'cvml', 'gokhanse...@gmail.com');>> >> >>> >>> >>> On Sat, Nov 17, 2012 at 9:47 AM, Nathaniel Smith >>> >>> > wrote: >>> On Fri, Nov

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Charles R Harris
On Sat, Nov 17, 2012 at 1:00 PM, Olivier Delalleau wrote: > 2012/11/17 Gökhan Sever > >> >> >> On Sat, Nov 17, 2012 at 9:47 AM, Nathaniel Smith wrote: >> >>> On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever >>> wrote: >>> > Thanks for the explanations. >>> > >>> > For either case, I was expecting

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Olivier Delalleau
2012/11/17 Gökhan Sever > > > On Sat, Nov 17, 2012 at 9:47 AM, Nathaniel Smith wrote: > >> On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever >> wrote: >> > Thanks for the explanations. >> > >> > For either case, I was expecting to get float32 as a resulting data >> type. >> > Since, float32 is larg

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Gökhan Sever
On Sat, Nov 17, 2012 at 9:47 AM, Nathaniel Smith wrote: > On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever > wrote: > > Thanks for the explanations. > > > > For either case, I was expecting to get float32 as a resulting data type. > > Since, float32 is large enough to contain the result. I am wonde

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Nathaniel Smith
On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever wrote: > Thanks for the explanations. > > For either case, I was expecting to get float32 as a resulting data type. > Since, float32 is large enough to contain the result. I am wondering if > changing casting rule this way, requires a lot of modificati

[Numpy-discussion] Assignment function with a signature similar to take?

2012-11-17 Thread Eric Moore
Is there a function that operates like 'take' but does assignment? Specifically that takes indices and an axis? As far as I can tell no such function exists. Is there any particular reason? One can fake such a thing by doing (code untested): s = len(a.shape)*[np.s_[:]] s[axis] = np.s_[1::2] a

Re: [Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-17 Thread Chao YUE
Yes, both the "base" and "target" are ascending. Thanks! Chao On Sat, Nov 17, 2012 at 2:40 PM, Benjamin Root wrote: > > > On Saturday, November 17, 2012, Chao YUE wrote: > >> Dear all, >> >> I need to make a linear contrast of the 2D numpy array "data" from an >> interval to another, the appro

Re: [Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-17 Thread Benjamin Root
On Saturday, November 17, 2012, Chao YUE wrote: > Dear all, > > I need to make a linear contrast of the 2D numpy array "data" from an > interval to another, the approach is: > I have another two list: "base" & "target", then I check for each ndarray > element "data[i,j]", > if base[m] =< data[i,

[Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-17 Thread Chao YUE
Dear all, I need to make a linear contrast of the 2D numpy array "data" from an interval to another, the approach is: I have another two list: "base" & "target", then I check for each ndarray element "data[i,j]", if base[m] =< data[i,j] <= base[m+1], then it will be linearly converted to be in t