Simplify (drop useless intermediate sum and diff arrays).