Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Geoffrey Irving
On Sun, Dec 4, 2011 at 6:45 PM, Charles R Harris wrote: > > > On Sun, Dec 4, 2011 at 6:59 PM, Geoffrey Irving wrote: >> >> On Sun, Dec 4, 2011 at 5:18 PM, Charles R Harris >> wrote: >> > >> > >> > On Sun, Dec 4, 2011 at 5:41 PM, Geoffrey Irving wrote: >> >> >> >> This may be the problem.  Simpl

Re: [Numpy-discussion] NumPy Governance

2011-12-04 Thread Travis Oliphant
Great points. My initial suggestion of 5-11 was more about current board size rather than trying to fix it. I agree that having someone represent from major downstream projects would be a great thing. -Travis On Dec 4, 2011, at 7:16 AM, Alan G Isaac wrote: > On 12/4/2011 1:43 AM, Charle

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Charles R Harris
On Sun, Dec 4, 2011 at 6:59 PM, Geoffrey Irving wrote: > On Sun, Dec 4, 2011 at 5:18 PM, Charles R Harris > wrote: > > > > > > On Sun, Dec 4, 2011 at 5:41 PM, Geoffrey Irving wrote: > >> > >> This may be the problem. Simple diffs are pleasant. I'm guessing > >> this code doesn't get a lot of

Re: [Numpy-discussion] stacking scalars with column vector

2011-12-04 Thread Santhosh R
Thanks Oliver. You can do it in one shot with: > > x = np.vstack((Xstart, A[:, 0:1], Xend)) > > Using A[:, 0:1] instead of A[:, 0] lets you keep it as a 2d matrix (this > should answer your last question). > Then the scalars Xstart and Xend will automatically be broadcasted to > accomodate the sha

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Geoffrey Irving
On Sun, Dec 4, 2011 at 5:18 PM, Charles R Harris wrote: > > > On Sun, Dec 4, 2011 at 5:41 PM, Geoffrey Irving wrote: >> >> This may be the problem.  Simple diffs are pleasant.  I'm guessing >> this code doesn't get a lot of testing.  Glad it's there, though! >> >> Geoffrey >> >> diff --git a/nump

Re: [Numpy-discussion] bug in PyArray_GetCastFunc

2011-12-04 Thread Charles R Harris
On Sun, Dec 4, 2011 at 6:30 PM, Geoffrey Irving wrote: > On Sun, Dec 4, 2011 at 10:02 AM, Charles R Harris > wrote: > > > > > > On Sat, Dec 3, 2011 at 5:28 PM, Geoffrey Irving wrote: > >> > >> When attempting to cast to a user defined type, PyArray_GetCast looks > >> up the cast function in the

Re: [Numpy-discussion] bug in PyArray_GetCastFunc

2011-12-04 Thread Geoffrey Irving
On Sun, Dec 4, 2011 at 10:02 AM, Charles R Harris wrote: > > > On Sat, Dec 3, 2011 at 5:28 PM, Geoffrey Irving wrote: >> >> When attempting to cast to a user defined type, PyArray_GetCast looks >> up the cast function in the dictionary but doesn't check if the entry >> exists.  This causes segfau

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Charles R Harris
On Sun, Dec 4, 2011 at 5:41 PM, Geoffrey Irving wrote: > This may be the problem. Simple diffs are pleasant. I'm guessing > this code doesn't get a lot of testing. Glad it's there, though! > > Geoffrey > > diff --git a/numpy/core/src/umath/ufunc_type_resolution.c > b/numpy/core/src/umath/ufunc

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Geoffrey Irving
This may be the problem. Simple diffs are pleasant. I'm guessing this code doesn't get a lot of testing. Glad it's there, though! Geoffrey diff --git a/numpy/core/src/umath/ufunc_type_resolution.c b/numpy/core/src/umath/ufunc_type_resolution.c index 0d6cf19..a93eda1 100644 --- a/numpy/core/src

Re: [Numpy-discussion] stacking scalars with column vector

2011-12-04 Thread Olivier Delalleau
You can do it in one shot with: x = np.vstack((Xstart, A[:, 0:1], Xend)) Using A[:, 0:1] instead of A[:, 0] lets you keep it as a 2d matrix (this should answer your last question). Then the scalars Xstart and Xend will automatically be broadcasted to accomodate the shape of A[:, 0:1], so you don'

[Numpy-discussion] stacking scalars with column vector

2011-12-04 Thread Santhosh R
Hi , I am trying to learn python to convert some of my mlab codes to python.Am new to python.Some help here would be appreciated I am trying to make a column vector by stacking two scalars-->Xstart,Xend and second column of n X 2 2Darray-->A In matlab the code is b=[Xstart;A(:,1);Xend] I have m

Re: [Numpy-discussion] bug in PyArray_GetCastFunc

2011-12-04 Thread Charles R Harris
On Sat, Dec 3, 2011 at 5:28 PM, Geoffrey Irving wrote: > When attempting to cast to a user defined type, PyArray_GetCast looks > up the cast function in the dictionary but doesn't check if the entry > exists. This causes segfaults. Here's a patch. > > Geoffrey > > diff --git a/numpy/core/src/mu

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Charles R Harris
On Sat, Dec 3, 2011 at 8:14 PM, Geoffrey Irving wrote: > Hello, > > I'm trying to add a fixed precision rational number dtype to numpy, > and am running into an issue trying to register ufunc loops. The code > in question looks like > >int npy_rational = PyArray_RegisterDataType(&rational_de

Re: [Numpy-discussion] NumPy Governance

2011-12-04 Thread Charles R Harris
On Sun, Dec 4, 2011 at 6:16 AM, Alan G Isaac wrote: > On 12/4/2011 1:43 AM, Charles R Harris wrote: > > I don't think there are 5 active developers, let alone 11. > > With hard work you might scrape together two or three. > > Having 5 or 11 people making decisions for the two or > > three actuall

Re: [Numpy-discussion] NumPy Governance

2011-12-04 Thread Alan G Isaac
On 12/4/2011 1:43 AM, Charles R Harris wrote: > I don't think there are 5 active developers, let alone 11. > With hard work you might scrape together two or three. > Having 5 or 11 people making decisions for the two or > three actually doing the work isn't going to go over well. Very true! But yo

Re: [Numpy-discussion] Convert datetime64 to python datetime.datetime in numpy 1.6.1?

2011-12-04 Thread Warren Weckesser
On Sun, Dec 4, 2011 at 5:30 AM, Didrik Pinte wrote: > On Sun, Dec 4, 2011 at 6:11 AM, Warren Weckesser > wrote: > > In numpy 1.6.1, what's the most straightforward way to convert a > datetime64 > > to a python datetime.datetime? E.g. I have > > > > In [1]: d = datetime64("2011-12-03 12:34:56.75

Re: [Numpy-discussion] Convert datetime64 to python datetime.datetime in numpy 1.6.1?

2011-12-04 Thread Didrik Pinte
On Sun, Dec 4, 2011 at 6:11 AM, Warren Weckesser wrote: > In numpy 1.6.1, what's the most straightforward way to convert a datetime64 > to a python datetime.datetime?  E.g. I have > > In [1]: d = datetime64("2011-12-03 12:34:56.75") > > In [2]: d > Out[2]: 2011-12-03 12:34:56.75 > > I want the