Re: [Numpy-discussion] Determining if two arrays share data

2006-07-06 Thread Rob W.W. Hooft
Albert Strasheim wrote: > I think we might be talking about two related but different concepts. One is > sharing of data between arrays, the other is whether the data overlaps. When is it useful to know whether data buffers overlap? As long as they are disjoint, it should be irrelevant at the hig

Re: [Numpy-discussion] Determining if two arrays share data

2006-07-06 Thread Albert Strasheim
Hello all > > Python 2.3b1+ (#2, Jun 10 2003, 20:53:51) > [GCC 3.0.2 20010905 (Red Hat Linux 7.1 3.0.1-3)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import Numeric > >>> a=Numeric.arange(20) > >>> b=a[::2] > >>> c=a[1::2] > >>> a > array([ 0, 1

Re: [Numpy-discussion] Determining if two arrays share data

2006-07-06 Thread Rob W.W. Hooft
Stefan van der Walt wrote: > On Thu, Jul 06, 2006 at 11:39:19AM +0900, Bill Baxter wrote: > >>Often when I'm doing interactive prototyping I find myself wanting to check >>whether two arrays are sharing a copy of the same data. > > > Say you have > > x = N.array([1,2,3,4]) > > and > > y = x.r

Re: [Numpy-discussion] Determining if two arrays share data

2006-07-06 Thread Stefan van der Walt
On Thu, Jul 06, 2006 at 11:39:19AM +0900, Bill Baxter wrote: > Often when I'm doing interactive prototyping I find myself wanting to check > whether two arrays are sharing a copy of the same data. > > It seems like there ought to be a concise way to do that, but right now seems > like the only way

[Numpy-discussion] Determining if two arrays share data

2006-07-05 Thread Bill Baxter
Often when I'm doing interactive prototyping I find myself wanting to check whether two arrays are sharing a copy of the same data. It seems like there ought to be a concise way to do that, but right now seems like the only way is with a little function like this:def same_base(a,b):     ab = a.base