How can I make this function faster? It removes the i-th row and
column from an array.
def cut(x, i):
idx = range(x.shape[0])
idx.remove(i)
y = x[idx,:]
y = y[:,idx]
return y
>> import numpy as np
>> x = np.random.rand(500,500)
>> timeit cut(x, 100)
100 loops, best of 3: 16.8 ms per loop