How to scale down a list of integers

48 Views Asked by At

I have a list, that can be of various lengths (less than 100 or more than 1.800.000) and I need to "shrink down" the list to 800 values.

I have tried taking a value for every step, where a step is the list length / 800. And it is the closest I can get to. I have tried taking the average value of the n surrounding of step with various n, but I can't get a waveform that satisfies me.

I know image compression work by taking an average of surrounding pixels, and I am trying to do the same with a list of values. I need to preserve the global aspect, but also the highest and lowest spikes.