Since `sort_indices` changes the input, don't we need an explicit `copy` here?