Tag: numpy
-
From R array to Numpy array
7 Lets say, I have a following R array a <- array(1:18, dim = c(3, 3, 2)) r$> a , , 1 [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 , , 2 [,1] [,2] [,3] [1,] 10 13 16 [2,] 11 14 17 [3,] 12 15 18…
-
Unexpected uint64 behaviour 0xFFFF’FFFF’FFFF’FFFF – 1 = 0?
28 Consider the following brief numpy session showcasing uint64 data type import numpy as np a = np.zeros(1,np.uint64) a # array([0], dtype=uint64) a[0] -= 1 a # array([18446744073709551615], dtype=uint64) # this is 0xffff ffff ffff ffff, as expected a[0] -= 1 a # array([0], dtype=uint64) # what the heck? I’m utterly confused by this last…