As the title suggests, the np.argsort(np.zeros(n)) can gives right result if n<=16, otherwise, it will give a strange result, e.g.,
np.argsort(np.zeros(17))
# array([ 0, 14, 13, 12, 11, 10, 9, 15, 8, 6, 5, 4, 3, 2, 1, 7, 16], dtype=int64)
np.argsort(np.zeros(18))
# array([ 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 17], dtype=int64)
Can anyone explain? Thanks!
try ‘stable’ mode will work.