[SciPy-user] Concatenating 1D arrays
ryanlists at gmail.com
Wed Feb 8 09:05:08 CST 2006
Growing arrays will be less efficient in NumPy as well (I can't think
of a way to avoid this in any language), because you need to allocate
more memory each time you add a row or column. I don't know if this
is slightly better in Python vs. Matlab because Python uses references
so much and Matlab makes copies of almost everything.
On 2/8/06, Rudolph van der Merwe <rudolphv at gmail.com> wrote:
> > The way I prefer is to initialize x and y with full dimension and "fill"
> > it. This is imho easier to read and shorter.
> The problem is that the full dimension, i.e. number of vectors to be
> concatenated is not known apriori. I know that growing arrays in-place
> as apposed to filling a pre-sized array is very inefficient in Matlab
> (is this also the case for Numpy?), but sometimes it cannot be
> Rudolph van der Merwe
> SciPy-user mailing list
> SciPy-user at scipy.net
More information about the SciPy-user