[Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)

2009-10-17 Thread per freem
hi all, in my code, i use the function 'logsumexp' from scipy.maxentropy a lot. as far as i can tell, this function has no vectorized version that works on an m-x-n matrix. i might be doing something wrong here, but i found that this function can run extremely slowly if used as follows: i have an

Re: [Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)

2009-10-17 Thread Keith Goodman
On Sat, Oct 17, 2009 at 8:36 AM, per freem perfr...@gmail.com wrote: hi all, in my code, i use the function 'logsumexp' from scipy.maxentropy a lot. as far as i can tell, this function has no vectorized version that works on an m-x-n matrix. i might be doing something wrong here, but i found

Re: [Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)

2009-10-17 Thread Charles R Harris
On Sat, Oct 17, 2009 at 9:36 AM, per freem perfr...@gmail.com wrote: hi all, in my code, i use the function 'logsumexp' from scipy.maxentropy a lot. as far as i can tell, this function has no vectorized version that works on an m-x-n matrix. i might be doing something wrong here, but i

Re: [Numpy-discussion] double-precision sqrt?

2009-10-17 Thread Dag Sverre Seljebotn
Adam Ginsburg wrote: Hi folks, I'm trying to write a ray-tracing code for which high precision is required. I also need to use square roots. However, math.sqrt and numpy.sqrt seem to only use single-precision floats. Is there a simple way to make sqrt use higher precision? Alternately,

Re: [Numpy-discussion] double-precision sqrt?

2009-10-17 Thread Nadav Horesh
The default precision is double unless yue specify otherwise (float32 or long double (float128 or float96)) You can see this from: f(fsolve(f,1.01)) # 1.7763568394002505e-15 The last line should be: fsolve(f,1.01) - float64(1.034324523462345) 8.8817841970012523e-16 Nadav -הודעה

Re: [Numpy-discussion] double-precision sqrt?

2009-10-17 Thread Charles R Harris
On Sat, Oct 17, 2009 at 12:08 PM, Adam Ginsburg adam.ginsb...@colorado.eduwrote: Hi folks, I'm trying to write a ray-tracing code for which high precision is required. I also need to use square roots. However, math.sqrt and numpy.sqrt seem to only use single-precision floats. Is there a

Re: [Numpy-discussion] double-precision sqrt?

2009-10-17 Thread Anne Archibald
2009/10/17 Adam Ginsburg adam.ginsb...@colorado.edu: My code is actually wrong but I still have the problem I've identified that sqrt is leading to precision errors.  Sorry about the earlier mistake. I think you'll find that numpy's sqrt is as good as it gets for double precision. You can

Re: [Numpy-discussion] double-precision sqrt?

2009-10-17 Thread Adam Ginsburg
Hi again, I apologize, the mistake was entirely my own. Sqrt's do the right thing Adam On Sat, Oct 17, 2009 at 12:17 PM, Adam Ginsburg adam.ginsb...@colorado.edu wrote: My code is actually wrong but I still have the problem I've identified that sqrt is leading to precision errors.  

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-17 Thread Charles R Harris
On Sat, Oct 17, 2009 at 6:49 AM, Darren Dale dsdal...@gmail.com wrote: numpy's functions, especially ufuncs, have had some ability to support subclasses through the ndarray.__array_wrap__ method, which provides masked arrays or quantities (for example) with an opportunity to set the class and

Re: [Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)

2009-10-17 Thread josef . pktd
On Sat, Oct 17, 2009 at 2:02 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Oct 17, 2009 at 11:54 AM, josef.p...@gmail.com wrote: On Sat, Oct 17, 2009 at 1:20 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Oct 17, 2009 at 9:36 AM, per freem

Re: [Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)

2009-10-17 Thread Charles R Harris
On Sat, Oct 17, 2009 at 5:27 PM, josef.p...@gmail.com wrote: On Sat, Oct 17, 2009 at 2:02 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Oct 17, 2009 at 11:54 AM, josef.p...@gmail.com wrote: On Sat, Oct 17, 2009 at 1:20 PM, Charles R Harris charlesr.har...@gmail.com

Re: [Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)

2009-10-17 Thread josef . pktd
On Sat, Oct 17, 2009 at 7:46 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Oct 17, 2009 at 5:27 PM, josef.p...@gmail.com wrote: On Sat, Oct 17, 2009 at 2:02 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Oct 17, 2009 at 11:54 AM, josef.p...@gmail.com

Re: [Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)

2009-10-17 Thread josef . pktd
On Sat, Oct 17, 2009 at 8:00 PM, josef.p...@gmail.com wrote: On Sat, Oct 17, 2009 at 7:46 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Oct 17, 2009 at 5:27 PM, josef.p...@gmail.com wrote: On Sat, Oct 17, 2009 at 2:02 PM, Charles R Harris charlesr.har...@gmail.com wrote:

Re: [Numpy-discussion] Subclassing record array

2009-10-17 Thread Charles R Harris
On Sat, Oct 17, 2009 at 9:13 AM, Loïc BERTHE berthe.l...@gmail.com wrote: Hi, I would like to create my own class of record array to deal with units. Here is the code I used, inspired from