[Numpy-discussion] question about optimizing
Charles R Harris
Sat May 17 14:13:05 CDT 2008
On Sat, May 17, 2008 at 1:02 PM, Anne Archibald <email@example.com>
> 2008/5/17 Charles R Harris <firstname.lastname@example.org>:
> > On Sat, May 17, 2008 at 9:52 AM, Alan G Isaac <email@example.com>
> >> 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
> > 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.
Exactly, which is why I suggested an extension to dtype so that it could
also specify arraya. In that way matrix multiplication on matrix stacks
would simply go over to an element wise matrix multiplication. In that case,
dtype would also be nestable so that one could have arrays of arrays of
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion