[Numpy-discussion] Resize Method for Numpy Array

2009-09-24 Thread Alice Invernizzi
Dear all, I have an Hamletic doubt concerning the numpy array data type. A general learned rule concerning the array usage in other high-level programming languages is that array data-type are homogeneous datasets of fixed dimension. Therefore, is not clear to me why in numpy the size of an

Re: [Numpy-discussion] Resize Method for Numpy Array

2009-09-24 Thread V. Armando Solé
Alice Invernizzi wrote: Dear all, I have an Hamletic doubt concerning the numpy array data type. A general learned rule concerning the array usage in other high-level programming languages is that array data-type are homogeneous datasets of fixed dimension. Therefore, is not clear to

Re: [Numpy-discussion] Resize Method for Numpy Array

2009-09-24 Thread V. Armando Solé
V. Armando Solé wrote: Sorry, there was a bug in the sent code. It should be: import numpy a=numpy.arange(100.) a.shape = 10, 10 b = a * 1 # just to get a copy b.shape = 5, 2, 5, 2 b = (b.sum(axis=3)).sum(axis=1) In that way, on b I have a binned image of a.

Re: [Numpy-discussion] Resize Method for Numpy Array

2009-09-24 Thread Christopher Barker
Alice Invernizzi wrote: Therefore, is not clear to me why in numpy the size of an array can be changed (either with the 'returning-value' resize() function either with the 'in-place' array method resize()). Would you please be so kind to give some explanation for the existence of resize

Re: [Numpy-discussion] Resize Method for Numpy Array

2009-09-24 Thread Robert Kern
On Thu, Sep 24, 2009 at 09:58, Alice Invernizzi inverni...@cilea.it wrote: Dear all, I have an Hamletic doubt concerning the numpy array data type. A general learned rule concerning the array usage in other high-level programming languages is that array data-type are homogeneous datasets of 

Re: [Numpy-discussion] Resize Method for Numpy Array

2009-09-24 Thread Sturla Molden
Robert Kern skrev: While this description is basically true of numpy arrays, I would caution you that every language has a different lexicon, and the same word can mean very different things in each. For example, Python lists are *not* linked lists; they are like C++'s std::vectors with a

Re: [Numpy-discussion] Resize Method for Numpy Array

2009-09-24 Thread Robert Kern
On Thu, Sep 24, 2009 at 17:32, Sturla Molden stu...@molden.no wrote: Robert Kern skrev: While this description is basically true of numpy arrays, I would caution you that every language has a different lexicon, and the same word can mean very different things in each. For example, Python lists

Re: [Numpy-discussion] Resize Method for Numpy Array

2009-09-24 Thread Sturla Molden
Robert Kern skrev: collections.deque() is a linked list of 64-item chunks. Thanks for that useful information. :-) But it would not help much for a binary tree... Since we are on the NumPy list... One could image making linked lists using NumPy arrays with dtype=object. They are storage