Re: [Numpy-discussion] .flat (was: add .H attribute?)

2013-07-23 Thread Alan G Isaac
On 7/23/2013 9:09 AM, Pauli Virtanen wrote: .flat which I think is rarely used Until ``diagonal`` completes its transition, use of ``flat`` seems the best way to reset the diagonal on an array. Am I wrong? I use it that way all the time. Alan Isaac

Re: [Numpy-discussion] .flat (was: add .H attribute?)

2013-07-23 Thread Stéfan van der Walt
On Tue, Jul 23, 2013 at 3:39 PM, Alan G Isaac alan.is...@gmail.com wrote: On 7/23/2013 9:09 AM, Pauli Virtanen wrote: .flat which I think is rarely used Until ``diagonal`` completes its transition, use of ``flat`` seems the best way to reset the diagonal on an array. Am I wrong? I use it

Re: [Numpy-discussion] .flat (was: add .H attribute?)

2013-07-23 Thread Benjamin Root
On Tue, Jul 23, 2013 at 10:11 AM, Stéfan van der Walt ste...@sun.ac.zawrote: On Tue, Jul 23, 2013 at 3:39 PM, Alan G Isaac alan.is...@gmail.com wrote: On 7/23/2013 9:09 AM, Pauli Virtanen wrote: .flat which I think is rarely used Don't assume .flat is not commonly used. A common

Re: [Numpy-discussion] .flat

2013-07-23 Thread Pauli Virtanen
23.07.2013 17:34, Benjamin Root kirjoitti: [clip] Don't assume .flat is not commonly used. A common idiom in matlab is a[:] to flatten an array. When porting code over from matlab, it is typical to replace that with either a.flat or a.flatten(), depending on whether an iterator or an array is

Re: [Numpy-discussion] .flat

2013-07-23 Thread Benjamin Root
On Tue, Jul 23, 2013 at 10:46 AM, Pauli Virtanen p...@iki.fi wrote: 23.07.2013 17:34, Benjamin Root kirjoitti: [clip] Don't assume .flat is not commonly used. A common idiom in matlab is a[:] to flatten an array. When porting code over from matlab, it is typical to replace that with

Re: [Numpy-discussion] .flat

2013-07-23 Thread Charles R Harris
On Tue, Jul 23, 2013 at 8:46 AM, Pauli Virtanen p...@iki.fi wrote: 23.07.2013 17:34, Benjamin Root kirjoitti: [clip] Don't assume .flat is not commonly used. A common idiom in matlab is a[:] to flatten an array. When porting code over from matlab, it is typical to replace that with

Re: [Numpy-discussion] .flat

2013-07-23 Thread Pauli Virtanen
23.07.2013 19:22, Charles R Harris kirjoitti: [clip] Grepping in my code, I find a lot of things like dfx = van.dot((ax2 - ax1).flat) IIRC, the flat version was faster than other methods. That goes through the same code path as `van.dot(np.asarray((ax2 - ax1).flat))`, which calls the

Re: [Numpy-discussion] .flat

2013-07-23 Thread Sebastian Berg
On Tue, 2013-07-23 at 10:22 -0600, Charles R Harris wrote: On Tue, Jul 23, 2013 at 8:46 AM, Pauli Virtanen p...@iki.fi wrote: 23.07.2013 17:34, Benjamin Root kirjoitti: [clip] Don't assume .flat is not commonly used. A common idiom in matlab is

Re: [Numpy-discussion] .flat

2013-07-23 Thread Charles R Harris
On Tue, Jul 23, 2013 at 10:36 AM, Pauli Virtanen p...@iki.fi wrote: 23.07.2013 19:22, Charles R Harris kirjoitti: [clip] Grepping in my code, I find a lot of things like dfx = van.dot((ax2 - ax1).flat) IIRC, the flat version was faster than other methods. That goes through the same

Re: [Numpy-discussion] .flat

2013-07-23 Thread josef . pktd
On Tue, Jul 23, 2013 at 1:05 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Tue, Jul 23, 2013 at 10:36 AM, Pauli Virtanen p...@iki.fi wrote: 23.07.2013 19:22, Charles R Harris kirjoitti: [clip] Grepping in my code, I find a lot of things like dfx = van.dot((ax2 - ax1).flat)