Re-arranging loop order in l.o.s. integral to improve caching.