def indexes_to_fix_for_low_rank(rank, size):
    #first we'll work out what to keep, and the do the set difference.

    #here are the indexes of the first column, which are the triangular numbers
    n = np.arange(size)
    triangulars = (n**2 + n) / 2
    keep = []
    for i in range(rank):
        keep.append(triangulars[i:] + i)
    #add the diagonal
    keep.append(triangulars[1:]-1)
    keep.append((size**2 + size)/2 -1)# the very last element
    keep = np.hstack(keep)

    return np.setdiff1d(np.arange((size**2+size)/2), keep)
Stochastic local search.
dataset/ETHPy150Open SheffieldML/GPy/GPy/util/choleskies.py/indexes_to_fix_for_low_rank--crossover with--dataset/ETHPy150Open automl/RoBO/robo/maximizers/stochastic_local_search.py/StochasticLocalSearch.__init__