[Numpy-discussion] lstsq functionality

Skipper Seabold jsseabold at gmail.com
Wed Jul 21 19:36:44 EDT 2010


On Wed, Jul 21, 2010 at 7:25 PM, David Warde-Farley <dwf at cs.toronto.edu> wrote:
> On 2010-07-20, at 10:16 PM, Skipper Seabold wrote:
>
>> Out of curiosity, is there an explicit way to check if these share memory?
>
>
> You could do the exact calculations (I think) but this isn't actually implemented in NumPy, though np.may_share_memory is a conservative test for it that will err on the side of false positives.
>

Ah, that's good to know.

In [5]: np.may_share_memory(b,c)
Out[5]: False

In [6]: a = b.view()

In [7]: np.may_share_memory(a,b)
Out[7]: True

In [8]: np.may_share_memory(a,c)
Out[8]: False



More information about the NumPy-Discussion mailing list