def total_rank_flops(D, M, N, cells, badness=0.5):
    # Corresponds to traversing a row or column of the multi-index grid
    worst_case = cells + 1

    # Corresponds to traversing a square in the multi-index grid
    best_case = 2 * sqrt(cells)

    # Interpolated number of clusters
    num_clusters = ceil(worst_case * badness + best_case * (1 - badness))

    # (total local projections required) + (total number of sums to compute distance)
    return num_clusters * (cluster_rotation_flops(D) + subquantizer_flops(D, M)) + N * (M - 1)
Given the dimension of the data, the number of subquantizers, the number
dataset/ETHPy150Open yahoo/lopq/scripts/query_runtime.py/total_rank_flops