[Numpy-discussion] question about optimizing

Anne Archibald peridot.faceted@gmail....
Sat May 17 14:02:54 CDT 2008


2008/5/17 Charles R Harris <charlesr.harris@gmail.com>:
>
>
> On Sat, May 17, 2008 at 9:52 AM, Alan G Isaac <aisaac@american.edu> wrote:
>>
>> On Fri, 16 May 2008, Anne Archibald apparently wrote:
>> > storing actual python objects in an array is probably not
>> > a good idea
>>
>> I have been wondering what people use object arrays for.
>> I have been guessing that it is for indexing convenience?
>> Are there other core motivations?
>
> You can always define an object array of matrices, which solves Tim's
> problem of matrix stacks, albeit in not the most efficient manner and not
> the easiest thing to specify due to the current limitations of array(...). I
> do think it would be nice to have arrays or arrays, but this needs one more
> array type so that one can do something like array(list_of_arrays,
> dtype=matrix((2,3),float)), i.e., we could use a fancier dtype.

I think if you're going to be writing code to do this, it would be
better not to use object arrays. After all, there no reason the
underlysing storage for an array of matrices shouldn't be one big
block of memory rather than a lot of scattered python objects.

Anne


More information about the Numpy-discussion mailing list