Re: [Numpy-discussion] Subclassing record array

2009-10-18 Thread Darren Dale
On Sun, Oct 18, 2009 at 12:22 AM, Charles R Harris charlesr.har...@gmail.com wrote: 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

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

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 md...@stsci.edu 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

Re: [Numpy-discussion] Optimized sum of squares

2009-10-18 Thread Skipper Seabold
On Sun, Oct 18, 2009 at 8:09 AM, Gael Varoquaux gael.varoqu...@normalesup.org 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,

[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

Re: [Numpy-discussion] Optimized sum of squares

2009-10-18 Thread josef . pktd
On Sun, Oct 18, 2009 at 12:06 PM, Skipper Seabold jsseab...@gmail.com wrote: On Sun, Oct 18, 2009 at 8:09 AM, Gael Varoquaux gael.varoqu...@normalesup.org 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

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 with

Re: [Numpy-discussion] Optimized sum of squares

2009-10-18 Thread Charles R Harris
On Sun, Oct 18, 2009 at 11:37 AM, josef.p...@gmail.com wrote: On Sun, Oct 18, 2009 at 12:06 PM, Skipper Seabold jsseab...@gmail.com wrote: On Sun, Oct 18, 2009 at 8:09 AM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Sun, Oct 18, 2009 at 09:06:15PM +1100, Gary Ruben wrote: Hi