[Numpy-discussion] array copy-to-self and views

Timothy Hochberg tim.hochberg@ieee....
Thu Feb 1 14:54:23 CST 2007


On 2/1/07, Christopher Barker <Chris.Barker@noaa.gov> wrote:
>
> Zachary Pincus wrote:
> > Say a function that (despite Tim's pretty
> > reasonable 'don't do that' warning) will return true when two arrays
> > have overlapping memory?
>
> I think it would be useful, even if it's not robust. I'd still like to
> know if a given two arrays COULD share data.
>
> I suppose to really be robust, what I'd really want to know is if a
> given array shares data with ANY other array, i.e. could changing this
> mess something up? -- but I'm pretty sure that is next to impossible


It's not totally impossible in theory -- languages like Haskell and Clean
(which I'm playing with now) manage to use arrays that get updated without
copying, while still maintaining the illusion that everything is constant
and thus you can't mess up any other arrays. While it's fun to play with and
Clean is allegedly pretty fast, it takes quite a bit of work to wrap ones
head around.

In a language like Python I expect that it would be pretty hard to come up
with something useful. Most of the checks would probably be too conservative
and thus not useful

-tim










-- 

//=][=\\

tim.hochberg@ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070201/86ff3e0b/attachment.html 


More information about the Numpy-discussion mailing list