The problem is very simple, I have a vector of indices from which I want to extract one set randomly chosen and its complement. So I write the following code:
import numpy as np
vec = np.arange(0,25000)
idx = np.random.choice(vec,5000)
idx_r = np.delete(vec,idx)
However, when I print the length of vec, idx, and idx_r they do not match. The sum between idx and idx_r return values higher than len(vec). For example, the following code:
print(len(idx))
print(len(idx_r))
print(len(idx_r)+len(idx))
print(len(vec))
returns:
5000 20462 25462 25000
Python version is 3.8.1 and GCC is 9.2.0.