Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Michael Gilbert
On Wed, Sep 8, 2010 at 5:35 PM, Michael Gilbert wrote: > On Wed, 8 Sep 2010 15:44:02 -0400, Michael Gilbert wrote: >> On Wed, Sep 8, 2010 at 12:23 PM, Charles R Harris wrote: >> > >> > >> > On Wed, Sep 8, 2010 at 9:46 AM, Michael Gilbert >> > wrote: >> >> >> >> On Wed, 8 Sep 2010 09:43:56 -0600,

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Michael Gilbert
On Wed, 8 Sep 2010 15:44:02 -0400, Michael Gilbert wrote: > On Wed, Sep 8, 2010 at 12:23 PM, Charles R Harris wrote: > > > > > > On Wed, Sep 8, 2010 at 9:46 AM, Michael Gilbert > > wrote: > >> > >> On Wed, 8 Sep 2010 09:43:56 -0600, Charles R Harris wrote: > >> > On Wed, Sep 8, 2010 at 9:26 AM, Mi

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Anne Archibald
On 8 September 2010 16:33, Robert Kern wrote: > On Wed, Sep 8, 2010 at 15:10, Michael Gilbert > wrote: >> On Wed, 8 Sep 2010 15:04:17 -0500, Robert Kern wrote: >>> On Wed, Sep 8, 2010 at 14:44, Michael Gilbert >>> wrote: > >>> > Just wanted to say that numpy object arrays + decimal solved all of

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Robert Kern
On Wed, Sep 8, 2010 at 15:10, Michael Gilbert wrote: > On Wed, 8 Sep 2010 15:04:17 -0500, Robert Kern wrote: >> On Wed, Sep 8, 2010 at 14:44, Michael Gilbert >> wrote: >> > Just wanted to say that numpy object arrays + decimal solved all of my >> > problems, which were all caused by the disconne

Re: [Numpy-discussion] inversion of large matrices

2010-09-08 Thread Daniel Elliott
Wow, this is great! Thanks for all the great questions. Sebastian Walter gmail.com> writes: > is it really the covariance matrix you want to invert? Or do you want > to compute something like > x^T C^{-1} x, > where x is an array of size N and C an array of size (N,N)? Yes, this is what I am c

Re: [Numpy-discussion] clip() with None as argument

2010-09-08 Thread Robert Kern
On Wed, Sep 8, 2010 at 14:42, Chris Ball wrote: > Robert Kern gmail.com> writes: > >> >> On Tue, Sep 7, 2010 at 15:12, Friedrich Romstedt >> gmail.com> wrote: >> > Ah, no need to answer, I do this myself: >> > >> > Friedrich, would you please use numpy.inf and -numpy.inf. >> >> But if you have a

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Michael Gilbert
On Wed, 8 Sep 2010 22:20:30 +0200, Sandro Tosi wrote: > On Wed, Sep 8, 2010 at 22:10, Michael Gilbert > wrote: > > Here is an example: > > > >   >>> 0.3/3.0 - 0.1 > >   -1.3877787807814457e-17 > > > >   >>> mpmath.mpf( '0.3' )/mpmath.mpf( '3.0' ) - mpmath.mpf( '0.1' ) > >   mpf('-1.387778780781445

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Sandro Tosi
On Wed, Sep 8, 2010 at 22:10, Michael Gilbert wrote: > Here is an example: > >   >>> 0.3/3.0 - 0.1 >   -1.3877787807814457e-17 > >   >>> mpmath.mpf( '0.3' )/mpmath.mpf( '3.0' ) - mpmath.mpf( '0.1' ) >   mpf('-1.3877787807814457e-17') > >   >>> decimal.Decimal( '0.3' )/decimal.Decimal( '3.0' ) - de

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Michael Gilbert
On Wed, 8 Sep 2010 15:04:17 -0500, Robert Kern wrote: > On Wed, Sep 8, 2010 at 14:44, Michael Gilbert > wrote: > > On Wed, Sep 8, 2010 at 12:23 PM, Charles R Harris wrote: > >> > >> > >> On Wed, Sep 8, 2010 at 9:46 AM, Michael Gilbert > >> wrote: > >>> > >>> On Wed, 8 Sep 2010 09:43:56 -0600, Cha

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Robert Kern
On Wed, Sep 8, 2010 at 14:44, Michael Gilbert wrote: > On Wed, Sep 8, 2010 at 12:23 PM, Charles R Harris wrote: >> >> >> On Wed, Sep 8, 2010 at 9:46 AM, Michael Gilbert >> wrote: >>> >>> On Wed, 8 Sep 2010 09:43:56 -0600, Charles R Harris wrote: >>> > On Wed, Sep 8, 2010 at 9:26 AM, Michael Gilbe

Re: [Numpy-discussion] indexing with booleans without making a copy?

2010-09-08 Thread Ernest Adrogué
8/09/10 @ 15:35 (-0400), thus spake Anne Archibald: > 2010/9/8 Ernest Adrogué : > > I have a sorted, flat array: > > > > In [139]: a =np.array([0,1,2,2,2,3]) > > > > Basically, I want views of the areas where there > > are repeated numbers (since the array is sorted, they > > will be contiguous).

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Michael Gilbert
On Wed, Sep 8, 2010 at 12:23 PM, Charles R Harris wrote: > > > On Wed, Sep 8, 2010 at 9:46 AM, Michael Gilbert > wrote: >> >> On Wed, 8 Sep 2010 09:43:56 -0600, Charles R Harris wrote: >> > On Wed, Sep 8, 2010 at 9:26 AM, Michael Gilbert >> > > > > wrote: >> > >> > > Hi, >> > > >> > > Are there an

Re: [Numpy-discussion] clip() with None as argument

2010-09-08 Thread Chris Ball
Robert Kern gmail.com> writes: > > On Tue, Sep 7, 2010 at 15:12, Friedrich Romstedt > gmail.com> wrote: > > Ah, no need to answer, I do this myself: > > > > Friedrich, would you please use numpy.inf and -numpy.inf. > > But if you have an integer array, you will run into the same problem. > The

Re: [Numpy-discussion] indexing with booleans without making a copy?

2010-09-08 Thread josef . pktd
2010/9/8 Ernest Adrogué : > Hello, > > I have a sorted, flat array: > > In [139]: a =np.array([0,1,2,2,2,3]) > > Basically, I want views of the areas where there > are repeated numbers (since the array is sorted, they > will be contiguous). > > But, of course, to find the numbers that are repeated

Re: [Numpy-discussion] indexing with booleans without making a copy?

2010-09-08 Thread Anne Archibald
2010/9/8 Ernest Adrogué : > I have a sorted, flat array: > > In [139]: a =np.array([0,1,2,2,2,3]) > > Basically, I want views of the areas where there > are repeated numbers (since the array is sorted, they > will be contiguous). > > But, of course, to find the numbers that are repeated > I have to

[Numpy-discussion] indexing with booleans without making a copy?

2010-09-08 Thread Ernest Adrogué
Hello, I have a sorted, flat array: In [139]: a =np.array([0,1,2,2,2,3]) Basically, I want views of the areas where there are repeated numbers (since the array is sorted, they will be contiguous). But, of course, to find the numbers that are repeated I have to use comparison operations that ret

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Charles R Harris
On Wed, Sep 8, 2010 at 9:46 AM, Michael Gilbert wrote: > On Wed, 8 Sep 2010 09:43:56 -0600, Charles R Harris wrote: > > On Wed, Sep 8, 2010 at 9:26 AM, Michael Gilbert < > michael.s.gilb...@gmail.com > > > wrote: > > > > > Hi, > > > > > > Are there any plans to add support for decimal floating po

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread David Cournapeau
On Thu, Sep 9, 2010 at 12:43 AM, Charles R Harris wrote: > > > On Wed, Sep 8, 2010 at 9:26 AM, Michael Gilbert > wrote: >> >> Hi, >> >> Are there any plans to add support for decimal floating point >> arithmetic, as defined in the 2008 revision of the IEEE 754 standard >> [0], in numpy? >> > > No

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Michael Gilbert
On Wed, 8 Sep 2010 09:43:56 -0600, Charles R Harris wrote: > On Wed, Sep 8, 2010 at 9:26 AM, Michael Gilbert > wrote: > > > Hi, > > > > Are there any plans to add support for decimal floating point > > arithmetic, as defined in the 2008 revision of the IEEE 754 standard > > [0], in numpy? > > > >

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Charles R Harris
On Wed, Sep 8, 2010 at 9:26 AM, Michael Gilbert wrote: > Hi, > > Are there any plans to add support for decimal floating point > arithmetic, as defined in the 2008 revision of the IEEE 754 standard > [0], in numpy? > > Not at the moment. There is currently no hardware or C support and adding new

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Robert Kern
On Wed, Sep 8, 2010 at 10:26, Michael Gilbert wrote: > Hi, > > Are there any plans to add support for decimal floating point > arithmetic, as defined in the 2008 revision of the IEEE 754 standard > [0], in numpy? No, there are no plans. Although IEEE 754-2008 defines the format and semantics of s

[Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Michael Gilbert
Hi, Are there any plans to add support for decimal floating point arithmetic, as defined in the 2008 revision of the IEEE 754 standard [0], in numpy? Thanks for any info. Best wishes, Mike [0] http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4610935&tag=1 ___

Re: [Numpy-discussion] vectorize doesn't like functools.partial

2010-09-08 Thread Neal Becker
josef.p...@gmail.com wrote: > On Wed, Sep 8, 2010 at 10:53 AM, Neal Becker wrote: >> josef.p...@gmail.com wrote: >> >>> On Wed, Sep 8, 2010 at 7:44 AM, Neal Becker wrote: If I try to use vectorize on the result of functools.partial, I seem to get: ValueError: failed to deter

Re: [Numpy-discussion] vectorize doesn't like functools.partial

2010-09-08 Thread josef . pktd
On Wed, Sep 8, 2010 at 10:53 AM, Neal Becker wrote: > josef.p...@gmail.com wrote: > >> On Wed, Sep 8, 2010 at 7:44 AM, Neal Becker wrote: >>> If I  try to use vectorize on the result of functools.partial, I seem to >>> get: >>> >>> ValueError: failed to determine the number of arguments for >>>

Re: [Numpy-discussion] vectorize doesn't like functools.partial

2010-09-08 Thread Neal Becker
josef.p...@gmail.com wrote: > On Wed, Sep 8, 2010 at 7:44 AM, Neal Becker wrote: >> If I try to use vectorize on the result of functools.partial, I seem to >> get: >> >> ValueError: failed to determine the number of arguments for >> >> >> Anything I can do about it? > > Set .nin (attribute of

Re: [Numpy-discussion] ValueError: objects are not aligned

2010-09-08 Thread Rui DaCosta
rf1 = np.asarray(cursor1.fetchall(), dtype=np.float64).ravel() did the trick, 1d is perfect Thankyou very much! Rui From: "josef.p...@gmail.com" To: Discussion of Numerical Python Sent: Wed, September 8, 2010 3:30:54 PM Subject: Re: [Numpy-discussion] Val

Re: [Numpy-discussion] ValueError: objects are not aligned

2010-09-08 Thread Bruce Southey
On 09/08/2010 08:30 AM, josef.p...@gmail.com wrote: > On Wed, Sep 8, 2010 at 9:21 AM, Rui DaCosta wrote: >> Thanks again, >> >> I was trying to >> follow >> http://www.scipy.org/Numpy_Example_List#head-779283aaa3cc20a3786ad33c2ee1fee9d68a4a53 >> but with the key difference being, that instead o

Re: [Numpy-discussion] ValueError: objects are not aligned

2010-09-08 Thread josef . pktd
On Wed, Sep 8, 2010 at 9:21 AM, Rui DaCosta wrote: > Thanks again, > > I was trying to > follow http://www.scipy.org/Numpy_Example_List#head-779283aaa3cc20a3786ad33c2ee1fee9d68a4a53 > but with the key difference being, that instead of the data for the three > arrays being constructed from literals

Re: [Numpy-discussion] ValueError: objects are not aligned

2010-09-08 Thread Rui DaCosta
Thanks again, I was trying to follow http://www.scipy.org/Numpy_Example_List#head-779283aaa3cc20a3786ad33c2ee1fee9d68a4a53 but with the key difference being, that instead of the data for the three arrays being constructed from literals, that i'd be sourcing from a relational database. The

Re: [Numpy-discussion] new warning in 1.5.0: divide by zero encountered in log

2010-09-08 Thread Charles R Harris
On Wed, Sep 8, 2010 at 4:38 AM, John Reid wrote: > Hi, > > I recently upgraded to numpy 1.5.0 and now I get warnings when I take > the logarithm of 0. > > In [5]: np.log(0.) > Warning: divide by zero encountered in log > Out[5]: -inf > > > I want to evaluate x * log(x) where its value is defined a

Re: [Numpy-discussion] new warning in 1.5.0: divide by zero encountered in log

2010-09-08 Thread Alan G Isaac
On 9/8/2010 6:38 AM, John Reid wrote: > def safe_x_log_x(x): > "@return: x log(x) but replaces -inf with 0." > l = np.log(x) > result = x * l > result[np.isneginf(l)] = 0. > return result Assuming x is known to contain nonnegative floats: def safe_x_log_x(x): x =

Re: [Numpy-discussion] ValueError: objects are not aligned

2010-09-08 Thread josef . pktd
On Wed, Sep 8, 2010 at 8:08 AM, Rui DaCosta wrote: > Thanks for your assistance, > I was following this example: > http://www.scipy.org/Numpy_Example_List#head-779283aaa3cc20a3786ad33c2ee1fee9d68a4a53 I didn't know, If arrays are 1d, then numpy does the stacking for you., but it doesn't work with

Re: [Numpy-discussion] ValueError: objects are not aligned

2010-09-08 Thread Rui DaCosta
Thanks for your assistance, I was following this example: http://www.scipy.org/Numpy_Example_List#head-779283aaa3cc20a3786ad33c2ee1fee9d68a4a53 I intend to use different arrays once I have resolved this problem. Trying your suggestion: ... print (rf1) print (np.corrcoef(rf1, rf1, rowvar=0)) r

Re: [Numpy-discussion] vectorize doesn't like functools.partial

2010-09-08 Thread josef . pktd
On Wed, Sep 8, 2010 at 7:44 AM, Neal Becker wrote: > If I  try to use vectorize on the result of functools.partial, I seem to > get: > > ValueError: failed to determine the number of arguments for > > > Anything I can do about it? Set .nin (attribute of vectorized function, I think) directly wit

Re: [Numpy-discussion] DataArray fixes

2010-09-08 Thread Lluís
Fernando Perez writes: > Just let me know what you and the others (Keith, Skipper, Rob, etc) > think and I'm more than happy to open the doors to make the process > easier. Well, the pull requests I posted to your repository are for fairly trivial fixes (but some still need documentation and regre

[Numpy-discussion] vectorize doesn't like functools.partial

2010-09-08 Thread Neal Becker
If I try to use vectorize on the result of functools.partial, I seem to get: ValueError: failed to determine the number of arguments for Anything I can do about it? ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/

Re: [Numpy-discussion] ValueError: objects are not aligned

2010-09-08 Thread josef . pktd
On Wed, Sep 8, 2010 at 5:42 AM, RuiDC wrote: > > I'm getting this error, which must be a simple error in getting the result > from the cursor in the right shape, how do I get the cursor into the array > as a single dimension?: > >    import numpy as np >    import sqlite3 >    conn = sqlite3.conne

[Numpy-discussion] new warning in 1.5.0: divide by zero encountered in log

2010-09-08 Thread John Reid
Hi, I recently upgraded to numpy 1.5.0 and now I get warnings when I take the logarithm of 0. In [5]: np.log(0.) Warning: divide by zero encountered in log Out[5]: -inf I want to evaluate x * log(x) where its value is defined as 0 when x=0 so I have the following function: def safe_x_log_x(x

[Numpy-discussion] ValueError: objects are not aligned

2010-09-08 Thread RuiDC
I'm getting this error, which must be a simple error in getting the result from the cursor in the right shape, how do I get the cursor into the array as a single dimension?: import numpy as np import sqlite3 conn = sqlite3.connect("simpledb") cursor1 = conn.execute("select Log

Re: [Numpy-discussion] DataArray fixes

2010-09-08 Thread Fernando Perez
Hi Lluis, On Mon, Sep 6, 2010 at 12:17 PM, Lluís wrote: > I started writing some fixes for DataArray, but some others need discussion on > whether they should be implemented as I describe. > > To this extent, please see issues at http://github.com/fperez/datarray/issues > and comment on them, so