gnumpy icon indicating copy to clipboard operation
gnumpy copied to clipboard

bug when indexing using a tuple of lists

Open itakatz opened this issue 8 years ago • 0 comments

when indexing a gnumpy.garray using a tuple of 2 lists of indices, gnumpy's implementation of __getitem__ method casts the lists to the native gpu data type which is 32 bit float. Therefore, due to floating point round errors, indexing is not correct for moderately large matrices. Bug can be reproduced by the following code:

import gnumpy as gnp
a = gnp.randn(5000,5000)
if a.as_numpy_array()[([4001],[4001])] != a[([4001],[4001])]:
    print 'bug!'

itakatz avatar Nov 14 '16 20:11 itakatz