Added linear_to_index to matsub_freq