Hi
I’ve run into the non-contiguous array performance warning (issue #8131) when slicing a 2d array.
I’ve seen the ‘ellipsis’ work around for looping over the inner dimension of an array slice, but I want to loop over the outer dimension of an array slice. The ‘ellipsis’ workaround doesn’t seem to work in the case, or am I missing something?
This is my test, which generates the non-contiguous array warning, as posted in a comment for issue #8131…
@njit
def test(array2d):
slice2d = array2d[:, :4]
for i in range(len(array2d)):
#print(slice2d[i].flags)
_ = slice2d[i] @ slice2d[i] # Stupid calculation to illustrate point.
return
if I replace slice2d = array2d[:, :4]
with slice2d = array2d[..., :4]
, the ‘ellipsis’ workaround, I get the same warning.
Any help in getting rid of the warning would be appreciated.
Kind regards