nlcpy.may_share_memory

nlcpy.may_share_memory(a, b, max_work=None)

Determine if two arrays might share memory.

A return of True does not necessarily mean that the two arrays share any element. It just means that they might.

Parameters
a, bndarray

Input arrays

max_workint, optional

Effort to spend on solving the overlap problem. Please note that the current version supports only when max_work is None.

Returns
outbool

Dictionary containing the old settings.

Restriction

  • If max_work is not None, NotImplementedError occurs.

Examples

>>> import nlcpy as vp
>>> vp.may_share_memory(vp.array([1,2]), vp.array([5,8,9]))
False
>>> x = vp.zeros([3, 4])
>>> vp.may_share_memory(x[:,0], x[:,1])
True