New implementation of weighted sum

A more systematic implementation that covers dense arrays of arbitrary dimensions (using BLAS whenever possible). 

For more general arrays (under `AbstractArray`), it still falls back on Cartesian based implementation (a faster path is implemented when `dim = 1`).