use simpler approach to efficient averaging (from Hal Daume), and avoid expensive array operations in l2norm()