Re: [Numpy-discussion] request for SWIG numpy.i users

2013-06-08 Thread Tom Krauss
Hi folks, I just downloaded Bill's numpy.i at commit 4dcb0679, and tried it out a bit on some of my personal projects. It worked fine, although I use only a fraction of the capabilities that it includ

Re: [Numpy-discussion] np.asarray atleast_float64 ?

2013-06-08 Thread josef . pktd
On Sat, Jun 8, 2013 at 7:05 PM, Sebastian Berg wrote: > On Sat, 2013-06-08 at 08:52 -0400, josef.p...@gmail.com wrote: >> Is there anything to require a numpy array with a minimum numeric dtype? >> >> To avoid lower precision calculations and be upwards compatible, something >> like >> >> x = np.

Re: [Numpy-discussion] np.asarray atleast_float64 ?

2013-06-08 Thread Sebastian Berg
On Sat, 2013-06-08 at 08:52 -0400, josef.p...@gmail.com wrote: > Is there anything to require a numpy array with a minimum numeric dtype? > > To avoid lower precision calculations and be upwards compatible, something > like > > x = np.asarray(x, >=np.float64) np.result_type(arr, np.float64) use

Re: [Numpy-discussion] adding booleans

2013-06-08 Thread josef . pktd
On Sat, Jun 8, 2013 at 7:54 AM, Robert Kern wrote: > On Sat, Jun 8, 2013 at 12:40 PM, wrote: >> Question about namespace >> >> why is there bool and bool_ ? >> > np.bool(True) + np.bool(True) >> 2 > np.bool_(True) + np.bool_(True) >> True >> > type(np.bool(True)) >> > type(np.bo

[Numpy-discussion] np.asarray atleast_float64 ?

2013-06-08 Thread josef . pktd
Is there anything to require a numpy array with a minimum numeric dtype? To avoid lower precision calculations and be upwards compatible, something like x = np.asarray(x, >=np.float64) that converts ints, bool and lower precision to float64 but leaves higher precision float and complex double al

Re: [Numpy-discussion] adding booleans

2013-06-08 Thread josef . pktd
On Sat, Jun 8, 2013 at 5:18 AM, Sebastian Berg wrote: > On Sat, 2013-06-08 at 00:48 +0100, Nathaniel Smith wrote: >> On 7 Jun 2013 21:58, wrote: >> > >> > Interesting observation, (while lurking on a pull request) >> > >> > >>> np.add.reduce(np.arange(5)<3) >> > 3 >> > >>> np.add((np.arange(5)<3)

Re: [Numpy-discussion] supporting quad precision

2013-06-08 Thread Anne Archibald
Looking at the rational module, I think you're right: it really shouldn't be too hard to get quads working as a user type using gcc's __float128 type, which will provide hardware arithmetic in the unlikely case that the user has hardware quads. Alternatively, probably more work, one could use a pac

Re: [Numpy-discussion] adding booleans

2013-06-08 Thread Robert Kern
On Sat, Jun 8, 2013 at 12:40 PM, wrote: > Question about namespace > > why is there bool and bool_ ? > np.bool(True) + np.bool(True) > 2 np.bool_(True) + np.bool_(True) > True > type(np.bool(True)) > type(np.bool_(True)) > > > I didn't pay attention to the trailing underline

Re: [Numpy-discussion] adding booleans

2013-06-08 Thread josef . pktd
Question about namespace why is there bool and bool_ ? >>> np.bool(True) + np.bool(True) 2 >>> np.bool_(True) + np.bool_(True) True >>> type(np.bool(True)) >>> type(np.bool_(True)) I didn't pay attention to the trailing underline in Pauli's original example Josef

Re: [Numpy-discussion] adding booleans

2013-06-08 Thread Sebastian Berg
On Fri, 2013-06-07 at 20:29 -0400, josef.p...@gmail.com wrote: > On Fri, Jun 7, 2013 at 8:08 PM, wrote: > > On Fri, Jun 7, 2013 at 7:48 PM, Nathaniel Smith wrote: > >> On 7 Jun 2013 21:58, wrote: > >>> > >>> Interesting observation, (while lurking on a pull request) > >>> > >>> >>> np.add.reduc

Re: [Numpy-discussion] adding booleans

2013-06-08 Thread Pauli Virtanen
08.06.2013 02:48, Nathaniel Smith kirjoitti: [clip] > ...yeah weird. My gut reaction is that it's a bug. Addition on bools > should either be an error, undefined but doable via an implicit upcast > to int (analogous to calling np.sin on an int array triggering an upcast > to float), or xor (i.e., a

Re: [Numpy-discussion] adding booleans

2013-06-08 Thread Sebastian Berg
On Sat, 2013-06-08 at 00:48 +0100, Nathaniel Smith wrote: > On 7 Jun 2013 21:58, wrote: > > > > Interesting observation, (while lurking on a pull request) > > > > >>> np.add.reduce(np.arange(5)<3) > > 3 > > >>> np.add((np.arange(5)<3), (np.arange(5)<3)) > > array([ True, True, True, False, False