[Numpy-discussion] TypeError when calling numpy.kaiser()

2009-10-18 Thread Jeffrey McGee
Howdy, I'm having trouble getting the kaiser window to work. Anytime I try to call numpy.kaiser(), it throws an exception. Here's the output when I run the example code from http://docs.scipy.org/doc/numpy/reference/generated/numpy.kaiser.html : Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:

Re: [Numpy-discussion] Optimized sum of squares

2009-10-18 Thread Charles R Harris
On Sun, Oct 18, 2009 at 11:37 AM, wrote: > On Sun, Oct 18, 2009 at 12:06 PM, Skipper Seabold > wrote: > > On Sun, Oct 18, 2009 at 8:09 AM, Gael Varoquaux > > wrote: > >> On Sun, Oct 18, 2009 at 09:06:15PM +1100, Gary Ruben wrote: > >>> Hi Gaël, > >> > >>> If you've got a 1D array/vector called

Re: [Numpy-discussion] Optimized sum of squares

2009-10-18 Thread Sturla Molden
Skipper Seabold skrev: > I'm curious about this as I use ss, which is just np.sum(a*a, axis), > in statsmodels and didn't much think about it. > > Do the number of loops matter in the timings and is dot always faster > even without the blas dot? > The thing is that a*a returns a temporary array

Re: [Numpy-discussion] Optimized sum of squares

2009-10-18 Thread josef . pktd
On Sun, Oct 18, 2009 at 12:06 PM, Skipper Seabold wrote: > On Sun, Oct 18, 2009 at 8:09 AM, Gael Varoquaux > wrote: >> On Sun, Oct 18, 2009 at 09:06:15PM +1100, Gary Ruben wrote: >>> Hi Gaël, >> >>> If you've got a 1D array/vector called "a", I think the normal idiom is >> >>> np.dot(a,a) >> >>>

[Numpy-discussion] Multiple string formatting while writing an array into a file

2009-10-18 Thread Gökhan Sever
Hello, I have a relatively simple question which I couldn't figure out myself yet. I have an array that I am writing into a file using the following savetxt method. np.savetxt(fid, output_array, fmt='%12.4f', delimiter='') However, I have made some changes on the code and I require to write aft

Re: [Numpy-discussion] Optimized sum of squares

2009-10-18 Thread Skipper Seabold
On Sun, Oct 18, 2009 at 8:09 AM, Gael Varoquaux wrote: > On Sun, Oct 18, 2009 at 09:06:15PM +1100, Gary Ruben wrote: >> Hi Gaël, > >> If you've got a 1D array/vector called "a", I think the normal idiom is > >> np.dot(a,a) > >> For the more general case, I think >> np.tensordot(a, a, axes=somethin

Re: [Numpy-discussion] object array alignment issues

2009-10-18 Thread Charles R Harris
On Sun, Oct 18, 2009 at 6:04 AM, Michael Droettboom wrote: > On 10/16/2009 11:35 PM, Travis Oliphant wrote: > > > > On Oct 15, 2009, at 11:40 AM, Michael Droettboom wrote: > > > >> I recently committed a regression test and bugfix for object pointers in > >> record arrays of unaligned size (meani

Re: [Numpy-discussion] Optimized sum of squares

2009-10-18 Thread Gael Varoquaux
On Sun, Oct 18, 2009 at 09:06:15PM +1100, Gary Ruben wrote: > Hi Gaël, > If you've got a 1D array/vector called "a", I think the normal idiom is > np.dot(a,a) > For the more general case, I think > np.tensordot(a, a, axes=something_else) > should do it, where you should be able to figure out som

Re: [Numpy-discussion] Subclassing record array

2009-10-18 Thread Darren Dale
On Sun, Oct 18, 2009 at 12:22 AM, Charles R Harris wrote: > > > On Sat, Oct 17, 2009 at 9:13 AM, Loïc BERTHE 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 >> >> http://docs.scipy.org/doc/numpy-1.3.x/us

Re: [Numpy-discussion] object array alignment issues

2009-10-18 Thread Michael Droettboom
On 10/16/2009 11:35 PM, Travis Oliphant wrote: > > On Oct 15, 2009, at 11:40 AM, Michael Droettboom wrote: > >> I recently committed a regression test and bugfix for object pointers in >> record arrays of unaligned size (meaning where each record is not a >> multiple of sizeof(PyObject **)). >> >>

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

2009-10-18 Thread Darren Dale
On Sat, Oct 17, 2009 at 6:45 PM, Charles R Harris wrote: > > > On Sat, Oct 17, 2009 at 6:49 AM, Darren Dale wrote: [...] >> I think it will be not too difficult to document this overall scheme: >> >> When calling numpy functions: >> >> 1) __input_prepare__ provides an opportunity to operate on th

Re: [Numpy-discussion] Optimized sum of squares

2009-10-18 Thread Gary Ruben
Hi Gaël, If you've got a 1D array/vector called "a", I think the normal idiom is np.dot(a,a) For the more general case, I think np.tensordot(a, a, axes=something_else) should do it, where you should be able to figure out something_else for your particular case. Gary R. Gael Varoquaux wrote: >

[Numpy-discussion] Optimized sum of squares (was: vectorized version of logsumexp? (from scipy.maxentropy))

2009-10-18 Thread Gael Varoquaux
On Sat, Oct 17, 2009 at 07:27:55PM -0400, josef.p...@gmail.com wrote: > >> > Why aren't you using logaddexp ufunc from numpy? > >> Maybe because it is difficult to find, it doesn't have its own docs entry. Speaking of which... I thought that there was a readily-written, optimized function (or uf