Optimize freqwave sums.