Fix issues in determining return type of sum/prod along dim

- Fix reductions along dimensions of heterogeneously typed arrays
- `sumabs` and `sumabs2` for `Complex64`/`Complex128` should return `Float32`/`Float64`

cc @lindahua, @stevengj