Re: [Numpy-discussion] appending extra items to arrays

2007-10-17 Thread René Bastian
Hello, I work with numarray.zeros(n, numarray.Float64) as sound mixers ; there are huge number of datas : 44 000 .. 192 000 /second Operations : add, append, add & append (if the mixing begins on the existing part of the array + append if the array has to be prolonged) I do never use list-append

Re: [Numpy-discussion] appending extra items to arrays

2007-10-17 Thread Chad Kidder
Growing an array by appending it is the slow way in matlab. The suggested way to do things there is preallocate the array by saying x=zeros() and then referencing the elements in the array and inserting the correct value. --Chad Kidder On Oct 17, 2007, at 7:16 AM, mark wrote: So i

Re: [Numpy-discussion] appending extra items to arrays

2007-10-17 Thread mark
So it seems like lists are the way to grow an array. Interestingly enough, it is very easy to grown an array in Matlab. Any idea how they do that (or are they slow as well?). Mark On Oct 11, 8:53 pm, "Adam Mercer" <[EMAIL PROTECTED]> wrote: > On 11/10/2007, Mark Janikas <[EMAIL PROTECTED]> wrote

Re: [Numpy-discussion] appending extra items to arrays

2007-10-11 Thread Adam Mercer
On 11/10/2007, Mark Janikas <[EMAIL PROTECTED]> wrote: > If you do not know the size of your array before you finalize it, then > you should use lists whenever you can. I just cooked up a short > example: > # Result # > Total Time with array: 2.12951189331 > Total Time with list: 0.0469

Re: [Numpy-discussion] appending extra items to arrays

2007-10-11 Thread Mark Janikas
:[EMAIL PROTECTED] On Behalf Of Adam Mercer Sent: Thursday, October 11, 2007 7:42 AM To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] appending extra items to arrays On 11/10/2007, Robert Kern <[EMAIL PROTECTED]> wrote: > Appending to a list then converting the list to

Re: [Numpy-discussion] appending extra items to arrays

2007-10-11 Thread Adam Mercer
On 11/10/2007, Robert Kern <[EMAIL PROTECTED]> wrote: > Appending to a list then converting the list to an array is the most > straightforward way to do it. If the performance of this isn't a problem, I > recommend leaving it alone. Thanks, I'll leave it as is - I was just wondering if there was

Re: [Numpy-discussion] appending extra items to arrays

2007-10-11 Thread Timothy Hochberg
On 10/10/07, Anne Archibald <[EMAIL PROTECTED]> wrote: > > On 11/10/2007, Robert Kern <[EMAIL PROTECTED]> wrote: > > > Appending to a list then converting the list to an array is the most > > straightforward way to do it. If the performance of this isn't a > problem, I > > recommend leaving it alon

Re: [Numpy-discussion] appending extra items to arrays

2007-10-10 Thread Robert Kern
Anne Archibald wrote: > On 11/10/2007, Robert Kern <[EMAIL PROTECTED]> wrote: > >> Appending to a list then converting the list to an array is the most >> straightforward way to do it. If the performance of this isn't a problem, I >> recommend leaving it alone. > > Just a speculation: > > Python

Re: [Numpy-discussion] appending extra items to arrays

2007-10-10 Thread Anne Archibald
On 11/10/2007, Robert Kern <[EMAIL PROTECTED]> wrote: > Appending to a list then converting the list to an array is the most > straightforward way to do it. If the performance of this isn't a problem, I > recommend leaving it alone. Just a speculation: Python strings have a similar problem - the

Re: [Numpy-discussion] appending extra items to arrays

2007-10-10 Thread Robert Kern
Adam Mercer wrote: > Hi > > In some code I have, I need to append some extra data to a given > array. At the moment I construct the data in a list, append the extra > information I need and then convert the final list to an array. Is > there a way that I can append extra information to an existi

Re: [Numpy-discussion] appending extra items to arrays

2007-10-10 Thread Travis E. Oliphant
Adam Mercer wrote: > Hi > > In some code I have, I need to append some extra data to a given > array. At the moment I construct the data in a list, append the extra > information I need and then convert the final list to an array. Is > there a way that I can append extra information to an existin

Re: [Numpy-discussion] appending extra items to arrays

2007-10-10 Thread David Cournapeau
Adam Mercer wrote: > Hi > > In some code I have, I need to append some extra data to a given > array. At the moment I construct the data in a list, append the extra > information I need and then convert the final list to an array. Is > there a way that I can append extra information to an existin

[Numpy-discussion] appending extra items to arrays

2007-10-10 Thread Adam Mercer
Hi In some code I have, I need to append some extra data to a given array. At the moment I construct the data in a list, append the extra information I need and then convert the final list to an array. Is there a way that I can append extra information to an existing array thereby negating the n